[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 842
  • Last Modified:

GetWindowsDirectory is Returning the Wrong Folder

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

0
plq
Asked:
plq
  • 4
  • 4
2 Solutions
 
jkrCommented:
There's obvously something going *really* wrong. What results does

char* pWinDir = getenv("windir");

give?
0
 
jkrCommented:
Um, just as a side note - is that happening in Terminal Server mode?
0
 
plqAuthor Commented:
Possibly - citrix gotosupport I think

Sorry I meant to mention that and forgot
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
plqAuthor Commented:
The installer person has just gone home so cant run more tests till monday.

I don't know if it was citrix onto a desktop and then RDP onto the server, or citrix straight on the server.

I guess I'll get them to run setup from server console before doing any more. Will update this thread after that

thanks
0
 
jkrCommented:
BTW, if you're doing that to find out which version of .NET is installed, see http://support.microsoft.com/default.aspx?scid=kb;en-us;315291 ("How to detect the version of the .NET Framework that is installed in a deployment package in Visual Studio .NET")
0
 
plqAuthor Commented:
The problem only affects 2003 servers setup in application server mode

A change back to administrator TS mode fixed the problem.
0
 
plqAuthor Commented:
BTW program compatibility flags didnt fix it.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now