GetWindowsDirectory is Returning the Wrong Folder
Posted on 2005-03-11
Running a C++ setup program at a client. The program uses GetWindowsDirectory and then appends "\\Microsoft.NET\\Framework\\v1.1.4322" to it and checks if the folder exists.
At a single client, the program wasn't working so I sent in a test vb program and GetWindowsDirectory is returning
"C:\Documents And Settings\Administrator\Windows"
Now I can't easily change the setup.exe so is there anything I can do to the system that would make it return c:\windows instead ?
This is the VB test program - it was consistently ok with two machines here but returned "C:\Documents And Settings\Administrator\Windows" on the customers machine. Cust machine is 2003 server
Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Dim sResult As String
Dim sWindowsDir As String
sResult = Space(255)
GetWindowsDirectory sResult, 255
sWindowsDir = Left$(sResult, InStr(sResult, Chr$(0)) - 1)
MsgBox "Win dir " & sWindowsDir