Warning fixes.

This commit is contained in:
Alexandre Julliard 2002-11-15 04:17:00 +00:00
parent 56ab2b3e91
commit 9f029b7d5e
2 changed files with 13 additions and 11 deletions

View File

@ -426,12 +426,13 @@ BOOL WINAPI GetComputerNameExA(COMPUTER_NAME_FORMAT type, LPSTR name, LPDWORD si
memcpy( name, buf, len ); memcpy( name, buf, len );
name[len] = 0; name[len] = 0;
*size = len; *size = len;
ret = TRUE;
} }
} }
__EXCEPT(page_fault) __EXCEPT(page_fault)
{ {
SetLastError( ERROR_INVALID_PARAMETER ); SetLastError( ERROR_INVALID_PARAMETER );
ret = FALSE; return FALSE;
} }
__ENDTRY __ENDTRY
} }
@ -476,26 +477,27 @@ BOOL WINAPI GetComputerNameExW( COMPUTER_NAME_FORMAT type, LPWSTR name, LPDWORD
TRACE ("-> %s (%d)\n", debugstr_a (buf), len); TRACE ("-> %s (%d)\n", debugstr_a (buf), len);
__TRY __TRY
{ {
int len = MultiByteToWideChar( CP_ACP, 0, buf, len, NULL, 0 ); int lenW = MultiByteToWideChar( CP_ACP, 0, buf, len, NULL, 0 );
if ( *size < len ) if ( *size < lenW )
{ {
MultiByteToWideChar( CP_ACP, 0, buf, len, name, *size ); MultiByteToWideChar( CP_ACP, 0, buf, len, name, *size );
name[*size] = 0; name[*size] = 0;
*size = len; *size = lenW;
SetLastError( ERROR_MORE_DATA ); SetLastError( ERROR_MORE_DATA );
ret = FALSE; ret = FALSE;
} }
else else
{ {
MultiByteToWideChar( CP_ACP, 0, buf, len, name, len ); MultiByteToWideChar( CP_ACP, 0, buf, len, name, lenW );
name[len] = 0; name[lenW] = 0;
*size = len; *size = lenW;
ret = TRUE;
} }
} }
__EXCEPT(page_fault) __EXCEPT(page_fault)
{ {
SetLastError( ERROR_INVALID_PARAMETER ); SetLastError( ERROR_INVALID_PARAMETER );
ret = FALSE; return FALSE;
} }
__ENDTRY __ENDTRY
} }

View File

@ -101,7 +101,7 @@ int main(int argc, char* argv[])
/* try loading the UNICODE version first */ /* try loading the UNICODE version first */
strcpy(szEntryPoint,comma+1); strcpy(szEntryPoint,comma+1);
strcat(szEntryPoint,"W"); strcat(szEntryPoint,"W");
pfEntryPointW=LoadProc(szDllName, szEntryPoint, &DllHandle); pfEntryPointW=(EntryPointW)LoadProc(szDllName, szEntryPoint, &DllHandle);
if(pfEntryPointW!=NULL) if(pfEntryPointW!=NULL)
{ {
WCHAR wszCmdLine[2048]; WCHAR wszCmdLine[2048];
@ -112,11 +112,11 @@ int main(int argc, char* argv[])
{ {
strcpy(szEntryPoint,comma+1); strcpy(szEntryPoint,comma+1);
strcat(szEntryPoint,"A"); strcat(szEntryPoint,"A");
pfEntryPointA=LoadProc(szDllName, szEntryPoint, &DllHandle); pfEntryPointA=(EntryPointA)LoadProc(szDllName, szEntryPoint, &DllHandle);
if(pfEntryPointA==NULL) if(pfEntryPointA==NULL)
{ {
strcpy(szEntryPoint,comma+1); strcpy(szEntryPoint,comma+1);
pfEntryPointA=LoadProc(szDllName, szEntryPoint, &DllHandle); pfEntryPointA=(EntryPointA)LoadProc(szDllName, szEntryPoint, &DllHandle);
if(pfEntryPointA==NULL) if(pfEntryPointA==NULL)
return 0; return 0;
} }