cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
mweintraub
Level 3

kernel32.GetCurrentDirectory Not working properly after upgrade to IS 2012

I was using IS 2010 and upgraded to IS 2012 recently. The function, kernel32.GetCurrentDirectory was working properly before, but now it's only returning "C" (as in the drive letter?). Tested on WinXP and about to test on other O/Ses.

Nothing was touched in my code, so I'm not sure where to go. Is there another way of getting the current directory?


string sCurrentDir; // Current Dir of install/update exe



prototype void getCurrentDir();



// Prototype to get directory setup is running from
prototype kernel32.GetCurrentDirectory (NUMBER, BYREF STRING);



function void getCurrentDir()
begin
GetCurrentDirectory(512, sCurrentDir);
end;



Thanks in advance for any help you guys can provide.
Labels (1)
0 Kudos
3 Replies
mweintraub
Level 3

I've tried also the following

C++ functions
GetModuleFileName(null, sCurrentDir, _MAX_PATH); - Same Result

InstallShield
SRCDIR - It's the location of the extracted single exe

___________________________________________________

Found it!

When I shortened "GetCurrentDirectory" to "GetCurrentDir" in my Google search it brought up the following IS 2011 InstallScript Language Reference page:

http://helpnet.acresso.com/robo/projects/installshield17langref/langrefgetcurrentdir.htm

GetCurrentDir( svCurrentDir );



Was this introduced in 2011?

Carry on.
0 Kudos
MichaelU
Level 12 Flexeran
Level 12 Flexeran

I don't know when that function was introduced (I suspect it was a while back). However what caused this problem was the InstallScript support for Unicode in IS 2011. Since you had your own prototype for a function using a string, you would have also needed to follow the migration steps described in KB Article Q208911 Ensuring that Your InstallScript Code Supports Unicode.
0 Kudos
mweintraub
Level 3

Thanks for the info on the migration. I will read that. (Why can't you print that webpage? What's with the frame???)

I've already removed the C++ call and started using the built in function.
0 Kudos