prefix can be NULL for GetTempFileNameW.
This commit is contained in:
parent
58d6722e7a
commit
bf8319fdd5
|
@ -651,7 +651,7 @@ UINT WINAPI GetTempFileNameW( LPCWSTR path, LPCWSTR prefix, UINT unique, LPWSTR
|
|||
int i;
|
||||
LPWSTR p;
|
||||
|
||||
if ( !path || !prefix || !buffer )
|
||||
if ( !path || !buffer )
|
||||
{
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return 0;
|
||||
|
@ -663,7 +663,8 @@ UINT WINAPI GetTempFileNameW( LPCWSTR path, LPCWSTR prefix, UINT unique, LPWSTR
|
|||
/* add a \, if there isn't one */
|
||||
if ((p == buffer) || (p[-1] != '\\')) *p++ = '\\';
|
||||
|
||||
for (i = 3; (i > 0) && (*prefix); i--) *p++ = *prefix++;
|
||||
if (prefix)
|
||||
for (i = 3; (i > 0) && (*prefix); i--) *p++ = *prefix++;
|
||||
|
||||
unique &= 0xffff;
|
||||
|
||||
|
|
|
@ -335,9 +335,18 @@ static void test_InitPathA(CHAR *newdir, CHAR *curDrive, CHAR *otherDrive)
|
|||
sprintf(tmpstr1,"pat%x.tmp",id & 0xffff);
|
||||
ok(lstrcmpiA(newdir+lstrlenA(tmppath),tmpstr)==0 ||
|
||||
lstrcmpiA(newdir+lstrlenA(tmppath),tmpstr1)==0,
|
||||
"GetTempPath returned '%s' which doesn't match '%s' or '%s'. id=%x\n",
|
||||
"GetTempFileNameA returned '%s' which doesn't match '%s' or '%s'. id=%x\n",
|
||||
newdir,tmpstr,tmpstr1,id);
|
||||
|
||||
ok((id=GetTempFileNameA(tmppath,NULL,0,newdir)),"GetTempFileNameA failed\n");
|
||||
sprintf(tmpstr,"%.4x.tmp",id & 0xffff);
|
||||
sprintf(tmpstr1,"%x.tmp",id & 0xffff);
|
||||
ok(lstrcmpiA(newdir+lstrlenA(tmppath),tmpstr)==0 ||
|
||||
lstrcmpiA(newdir+lstrlenA(tmppath),tmpstr1)==0,
|
||||
"GetTempFileNameA returned '%s' which doesn't match '%s' or '%s'. id=%x\n",
|
||||
newdir,tmpstr,tmpstr1,id);
|
||||
|
||||
|
||||
/* Find first valid drive letter that is neither newdir[0] nor curDrive */
|
||||
drives = GetLogicalDrives() & ~(1<<(newdir[0]-'A'));
|
||||
if( *curDrive != NOT_A_VALID_DRIVE)
|
||||
|
|
Loading…
Reference in New Issue