?
Solved

GetWindowsDirectory is Returning the Wrong Folder

Posted on 2005-03-11
9
Medium Priority
?
806 Views
Last Modified: 2012-05-05
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
Comment
Question by:plq
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
9 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 13519169
There's obvously something going *really* wrong. What results does

char* pWinDir = getenv("windir");

give?
0
 
LVL 86

Expert Comment

by:jkr
ID: 13519191
Um, just as a side note - is that happening in Terminal Server mode?
0
 
LVL 8

Author Comment

by:plq
ID: 13519214
Possibly - citrix gotosupport I think

Sorry I meant to mention that and forgot
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 8

Author Comment

by:plq
ID: 13519250
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
 
LVL 86

Accepted Solution

by:
jkr earned 1000 total points
ID: 13519254
0
 
LVL 48

Assisted Solution

by:AlexFM
AlexFM earned 1000 total points
ID: 13519267
0
 
LVL 86

Expert Comment

by:jkr
ID: 13519286
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
 
LVL 8

Author Comment

by:plq
ID: 13552671
The problem only affects 2003 servers setup in application server mode

A change back to administrator TS mode fixed the problem.
0
 
LVL 8

Author Comment

by:plq
ID: 13552680
BTW program compatibility flags didnt fix it.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question