Author Topic: Get temp path problem  (Read 15887 times)

nobody

  • Guest
Get temp path problem
« on: January 22, 2009, 10:35:50 AM »
I want to using following code to get temp path:

invoke      GetTempPathA, MAX_PATH, szPath
invoke   MessageBoxA, dword NULL, szPath, 'ok', dword MB_OK

szPath: resd 1024

but alway get empty result in szPath, how to get GetTempPathA work?


Thanks,
Freeman

nobody

  • Guest
Re: Get temp path problem
« Reply #1 on: January 23, 2009, 04:10:38 PM »
Hi Freeman,

I don't do Windows, but according to this:

http://msdn.microsoft.com/en-us/library/aa364992(VS.85).aspx

it looks like you're doing it right. It suggests that if "MAX_PATH" is too big, it may fail - I assume it's defined to some sensible value (<32k ?)... The example suggests if it returns zero, print "can't get...". This sounds like it might fail, although I understand if it can't find TEMP, TMP, USER_PROFILE... it defaults to "\windows", so... when would it return zero??? Have you actually got TEMP/TMP set? If you've got one, try setting the other, I suppose... (not really sure what that would tell ya)...

Recently read on the Yahoo win32-nasm-users list that ReadFile on STDIN always returns 11, no matter what you type... This OS may not be ready for prime time. :) Good luck!

Best,
Frank

nobody

  • Guest
Re: Get temp path problem
« Reply #2 on: January 29, 2009, 09:43:58 AM »
Hi Frank,

Thanks.
Yes, MAX_PATH is too small, just 32, after change it to 512, the result is ok.


Regards,
Freeman