示例#1
0
TEST(SKF_ACCESS_CONTROL,SKF_ChangePIN_Test)
{
    ULONG* pulSize = new ULONG();
    ULONG result;
    LPSTR szAppName;
    ULONG *retryCount = new ULONG();


    SKF_EnumApplication skf_enumApplication = SKF_EnumApplication(GetProcAddress(hmodule,"SKF_EnumApplication"));
    result = skf_enumApplication(*devHandle,NULL,pulSize);
    EXPECT_EQ(0,(int)result);

    szAppName = (LPSTR)malloc(sizeof(char)*(*pulSize));

    result = skf_enumApplication(*devHandle,szAppName,pulSize);
    EXPECT_EQ(0,(int)result);

    SKF_OpenApplication skf_openApplication = SKF_OpenApplication(GetProcAddress(hmodule,"SKF_OpenApplication"));
    result = skf_openApplication(*devHandle,szAppName,&hApplication);
    EXPECT_EQ(0,(int)result);

    SKF_ChangePIN skf_changePIN = SKF_ChangePIN(GetProcAddress(hmodule,"SKF_ChangePIN"));
    *retryCount = 8;
    //result = skf_changePIN(hApplication,USER_TYPE,"11111111","22222222",retryCount);
    EXPECT_EQ(0,(int)result);
}
示例#2
0
BOOL CAuthTest::Test_ChangePIN()
{
    SHOW_PROCESS("ChangePIN");
    if (NULL == g_hApp)
    {
        printf("OPen application first!\n");
        return  FALSE;
    }

    int szBuf;
    ULONG nAccountType = 0;
    printf("Input 0: administrator, 1:User\n");

    fflush(stdin);
//	szBuf = getchar();
    szBuf = GetInputChar();

    if (szBuf == '0')
        nAccountType = 0;
    else if (szBuf == '1')
        nAccountType = 1;
    else
        return FALSE;

    char szOldPIN[256] = {0};
    char szNewPIN[256] = {0};
    ULONG nRetryNum = 0;

    printf("Input Old PIN:\n");
    fflush(stdin);
    gets(szOldPIN);

    printf("Input New PIN:\n");
    fflush(stdin);
    gets(szNewPIN);

    ULONG ulReval = SKF_ChangePIN(g_hApp, nAccountType, (LPSTR)szOldPIN, (LPSTR)szNewPIN, &nRetryNum);
    SHOW_ERROR(ulReval);

    return (SAR_OK == ulReval);
}