From 3dbc7881ea542f66a6144a57a42e790ca578995e Mon Sep 17 00:00:00 2001 From: Uwe Bonnes Date: Sun, 14 Feb 1999 17:32:46 +0000 Subject: [PATCH] Fix GetTempDrive behaviour. --- files/directory.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/files/directory.c b/files/directory.c index 3d81f69063d..9ef6efebe19 100644 --- a/files/directory.c +++ b/files/directory.c @@ -193,10 +193,18 @@ UINT32 DIR_GetSystemUnixDir( LPSTR path, UINT32 count ) */ BYTE WINAPI GetTempDrive( BYTE ignored ) { - char buffer[2]; + char *buffer; + BYTE ret; + UINT32 len = GetTempPath32A( 0, NULL ); + + if (!(buffer = HeapAlloc( GetProcessHeap(), 0, len + 1 )) ) + return DRIVE_GetCurrentDrive() + 'A'; + /* FIXME: apparently Windows does something with the ignored byte */ - if (!GetTempPath32A( sizeof(buffer), buffer )) buffer[0] = 'C'; - return toupper(buffer[0]); + if (!GetTempPath32A( len, buffer )) buffer[0] = 'C'; + ret = buffer[0]; + HeapFree( GetProcessHeap(), 0, buffer ); + return toupper(ret); }