I am having a problem making changes to a C program. The program makes a call to a function that will return wether or not a user belongs to an environment. I had to make changes to the calling function and therefore needed to make a new function for the comparison. My problem is that my new function does not compare the variables correctly and thus does not work. What do I need to change.
Old working function:
BOOL IsUserThisClient(USER_INFO_3 *pinfo)
{
char *cc, uuid[255];
int i;
if ( (cc = (char *)getenv("ENV_NAME"
) == NULL)
return TRUE;
if (!strcmp(cc, "Admin"
)
return TRUE;
for(i=0; *(UNICODE *)pinfo->usri3_usr_comment; i++)
uuid = *(UNICODE *)pinfo->usri3_usr_comment++;
uuid = '\0';
if (strstr(uuid, cc) != NULL)
return TRUE;
return FALSE;
}
New not working function:
BOOL IsUserThisClient_2(LPWSTR environment)
{
char *cc, uuid[255];
int i;
if ( (cc = (char *)getenv("ENV_NAME"
) == NULL)
return TRUE;
if (!strcmp(cc, "Admin"
)
return TRUE;
for(i=0; *(UNICODE *)environment; i++)
uuid = *(UNICODE *)environment++;
uuid = '\0';
if (strstr(uuid, cc) != NULL)
return TRUE;
return FALSE;
}
Please help.
Thanks in advance,
John
Old working function:
BOOL IsUserThisClient(USER_INFO_3 *pinfo)
{
char *cc, uuid[255];
int i;
if ( (cc = (char *)getenv("ENV_NAME"
return TRUE;
if (!strcmp(cc, "Admin"
return TRUE;
for(i=0; *(UNICODE *)pinfo->usri3_usr_comment; i++)
uuid = *(UNICODE *)pinfo->usri3_usr_comment++;
uuid = '\0';
if (strstr(uuid, cc) != NULL)
return TRUE;
return FALSE;
}
New not working function:
BOOL IsUserThisClient_2(LPWSTR environment)
{
char *cc, uuid[255];
int i;
if ( (cc = (char *)getenv("ENV_NAME"
return TRUE;
if (!strcmp(cc, "Admin"
return TRUE;
for(i=0; *(UNICODE *)environment; i++)
uuid = *(UNICODE *)environment++;
uuid = '\0';
if (strstr(uuid, cc) != NULL)
return TRUE;
return FALSE;
}
Please help.
Thanks in advance,
John