Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

vb6 on xp GetAttr("hiberfil.sys") gives RunTimeErr=5

Posted on 2004-04-07
8
Medium Priority
?
698 Views
Last Modified: 2008-02-01
On XP using VB6 in a DIR$ loop for all attribs when GetAttr() encounters "hiberfil.sys" I get a run time err = 5. What the ...
shifty@lighthouse.net
thanx
0
Comment
Question by:shifty12
  • 3
  • 3
8 Comments
 
LVL 17

Accepted Solution

by:
zzzzzooc earned 150 total points
ID: 10777978
There are some system files you seem to not be able to access. Use an If/Else statement or what-not to avoid it. The same applies to "pagefile.sys" (error I came across not too long ago).
0
 
LVL 28

Expert Comment

by:Ark
ID: 10780236
These files (hiberfil and pagefile) are virtual files - they doesn't exists on HDD, but are creating during system boot - this is why they can not be read
0
 
LVL 17

Expert Comment

by:zzzzzooc
ID: 10780303
The file actually exists and if you change the system's pagefile to point to another, you can delete the old. And if it's just an  empty file and the MFT reserves the disk-space for it for the system to use, the "virtual memory" data will still exist on the HDD.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 28

Expert Comment

by:Ark
ID: 10780334
Private Sub Command1_Click()
   Dim fso As Object
   Dim f As Object
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.GetFile("c:\hiberfil.sys")
   MsgBox GetFileAttr(f.Attributes), vbInformation, "hiberfil.sys attributes:"
   Set f = Nothing
   Set fso = Nothing
End Sub

Private Function GetFileAttr(ByVal lAttr As Long) As String
   Dim sAttr As String
   If lAttr And vbDirectory Then sAttr = "Directory"
   If sAttr <> "" Then sAttr = sAttr & vbCrLf
   If lAttr And vbSystem Then sAttr = sAttr & "System"
   If sAttr <> "" Then sAttr = sAttr & vbCrLf
   If lAttr And vbHidden Then sAttr = sAttr & "Hidden"
   If sAttr <> "" Then sAttr = sAttr & vbCrLf
   If lAttr And vbArchive Then sAttr = sAttr & "Archive"
   GetFileAttr = sAttr
End Function
0
 
LVL 17

Expert Comment

by:zzzzzooc
ID: 10780421
Is that supposed to mean the file doesn't exist? Then if it doesn't exist.. you can't delete it, right?.. ;)


"How to Delete the Pagefile.sys File in Recovery Console"
http://support.microsoft.com/?kbid=255205

"How to Manually Remove Windows XP and Restore Windows 95, Windows 98, or Windows Millennium"
http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3BQ314052

You'll notice "..Delete the Pagefile.sys and the Hiberfil.sys files." within the second and the first one is obvious. Nothing like deleting files that don't exist.. ;) Of course Microsoft doesn't know what they're talking about.. :[
0
 
LVL 28

Expert Comment

by:Ark
ID: 10781415
Sorry, my fault based on folowing MS words:
>>Windows NT uses a paging file for virtual memory called PAGEFILE.SYS.<< Agreed these files exists but are heavely protected by OS.
0
 

Author Comment

by:shifty12
ID: 10791956
Win-98 had paging files and other sys-files and vb6 never had a prob. I miss 98.
0

Featured Post

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.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

926 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