Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare Variables

Status
Not open for further replies.

jsaxon2

Programmer
Oct 24, 2001
56
US
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
 
2 Questions :

1 What is 'UNICODE' ? (#define'd somthing or ...)
2 Is your program compiled with /DUNICODE ?

/JOlesen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top