Does Windows 2k have a 'c:\windows\system32' folder

I wrote an app for someone with VB6 and sent it to him.  He has Windows 2k with sp4.  He is getting the following error:
File error 76
Path not found

I have XP so I can only test it with XP and it works fine.  I do reference the folder "C:\Windows\System32" in my app.  Is it possible that he is getting that error because Windows 2k doesn't have that folder.

LVL 23
Who is Participating?
rockiroadsConnect With a Mentor Commented:
the other experts are spot on, win2k broke the mould by going to c:\winnt
previously and after with xp, default is c:\windows
note users may also have installed windows in their own directory and not accept the default

Use the advice from egl1044, use an API, credit goes to egl1044 if u decide to use API

If u have sample code then fine, if not, then try this

Private Const MAX_PATH As Long = 260
Private Declare Function GetSystemDirectory Lib "kernel32" _
   Alias "GetSystemDirectoryA" _
  (ByVal lpBuffer As String, _
   ByVal nSize As Long) As Long

public Function GetSystemDir() As String

    Dim nSize As Long
    Dim buff As String
    buff = Space$(MAX_PATH)
    nSize = Len(buff)
    Call GetSystemDirectory(buff, nSize)
    GetSystemDir = TrimNull(buff)
End Function

Private Function TrimNull(item As String)

    Dim pos As Integer
   'double check that there is a chr$(0) in the string
    pos = InStr(item, Chr$(0))
    If pos Then
       TrimNull = Left$(item, pos - 1)
       TrimNull = item
    End If
End Function

If u call GetSystemDir, it will return u the name of the System32 folder

gecko_au2003Connect With a Mentor Commented:
It should do, it will obviously depend on where his windows folder is because some ppl install windows in WINNT or windows or something along those lines.

One way of doing it and I am sure there are other ways would be to use the FSO ( File System Object ) to attain the system32 folder for you as apposed to hard coding it.
nffvrxqgrcfqvvcConnect With a Mentor Commented:
gecko is right..

On windows 2000 it's C:\WINNT\system32\
On Windows XP it's C:\Windows\System32\

The error is probrably because you hard coded the path. You can use a couple different methods to obtain the system32 directory.


You can use API as well


Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

pradapkumarConnect With a Mentor Commented:
put the following line in a module

Public Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long

and use the follwoing snippet as you wish

    Dim strSysPath As String, i As Long
    strSysPath = Space(256)
    i = 256
    i = GetSystemDirectory(strSysPath, i)
    'Now strSysPath consists the system32 folder path.
    MsgBox Left$(strSysPath, i)

which will give you the current system path. So, Your program will be work without any error.

Thats all.
ahammarAuthor Commented:
Thank you all very very much!  I have tried and tested rockiroads's code and it works good on XP.  I assume it will work good on Win2k also but I'm still waiting to hear back from the client.  I will be back.  I'm pretty sure my problem is solved.  I will probably end up splitting points here somewhat.
Again, thank you all very much!
ahammarAuthor Commented:
Thanks to all of you.  I have heard back and it seems to work fine.  You guys are life savers.  I'm not sure how to be fair, but I think I should give rockiroads the majority of points because he (she) was first with a complete answer and code, and that is what I used.  I know pradapkumer's code would have worked just as well, so I thank all of you.
rockiroads: 350
egl1044: 50
gecko_ua2003: 50
pradapkumer: 50

No probs and thanks for the grade
but like I said, I just gave an example from what egl1044 said
The time delay due to testing of the code.
Its fine split and thankyou.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.