Solved

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

Posted on 2006-06-30
8
265 Views
Last Modified: 2011-03-11
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.

Thanks,
Cheers!
ahammar
0
Comment
Question by:ahammar
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 23

Assisted Solution

by:gecko_au2003
gecko_au2003 earned 50 total points
ID: 17016133
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.
0
 
LVL 29

Assisted Solution

by:nffvrxqgrcfqvvc
nffvrxqgrcfqvvc earned 50 total points
ID: 17016446
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.

Environ$("WINDIR")

You can use API as well

GetWindowsDirectory

0
 
LVL 65

Accepted Solution

by:
rockiroads earned 350 total points
ID: 17016521
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)
    Else
       TrimNull = item
    End If
 
End Function





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

0
 
LVL 9

Assisted Solution

by:pradapkumar
pradapkumar earned 50 total points
ID: 17016582
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.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 23

Author Comment

by:ahammar
ID: 17022031
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!
Cheers!
ahammar
0
 
LVL 23

Author Comment

by:ahammar
ID: 17022329
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

Cheers!
ahammar
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17022426
No probs and thanks for the grade
but like I said, I just gave an example from what egl1044 said
0
 
LVL 9

Expert Comment

by:pradapkumar
ID: 17024098
THankyou.
The time delay due to testing of the code.
Its fine split and thankyou.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now