shifty12
asked on
vb6 on xp GetAttr("hiberfil.sys") gives RunTimeErr=5
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
shifty@lighthouse.net
thanx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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.
Private Sub Command1_Click()
Dim fso As Object
Dim f As Object
Set fso = CreateObject("Scripting.Fi leSystemOb ject")
Set f = fso.GetFile("c:\hiberfil.s ys")
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
Dim fso As Object
Dim f As Object
Set fso = CreateObject("Scripting.Fi
Set f = fso.GetFile("c:\hiberfil.s
MsgBox GetFileAttr(f.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
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.. :[
"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.. :[
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.
>>Windows NT uses a paging file for virtual memory called PAGEFILE.SYS.<< Agreed these files exists but are heavely protected by OS.
ASKER
Win-98 had paging files and other sys-files and vb6 never had a prob. I miss 98.