Valhalla Legends Forums Archive | Battle.net Bot Development | VB CheckRevision + Windows OT = BLEH?

AuthorMessageTime
Camel
it seems that my (VB) checkrevision() code wont work on windows ot (9x/ME) systems--is it logical to suspect that certain kernel32 declares are responsible?
[code]Public Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, lpSecurityAttributes As SECURITY_ATTRIBUTES, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
Public Declare Function CreateFileMapping Lib "kernel32" Alias "CreateFileMappingA" (ByVal hFile As Long, lpFileMappigAttributes As SECURITY_ATTRIBUTES, ByVal flProtect As Long, ByVal dwMaximumSizeHigh As Long, ByVal dwMaximumSizeLow As Long, ByVal lpName As String) As Long
Public Declare Function MapViewOfFile Lib "kernel32" (ByVal hFileMappingObject As Long, ByVal dwDesiredAccess As Long, ByVal dwFileOffsetHigh As Long, ByVal dwFileOffsetLow As Long, ByVal dwNumberOfBytesToMap As Long) As Long
Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Public Declare Function UnmapViewOfFile Lib "kernel32" (lpBaseAddress As Any) As Long
Public Declare Function GetFileTime Lib "kernel32" (ByVal hFile As Long, lpCreationTime As FILETIME, lpLastAccessTime As FILETIME, lpLastWriteTime As FILETIME) As Long
Public Declare Function GetFileSize Lib "kernel32" (ByVal hFile As Long, lpFileSizeHigh As Long) As LongPublic Declare Function GetFileVersionInfoSize Lib "Version.dll" Alias "GetFileVersionInfoSizeA" (ByVal lptstrFilename As String, lpdwHandle As Long) As Long
Public Declare Function GetFileVersionInfo Lib "Version.dll" Alias "GetFileVersionInfoA" (ByVal lptstrFilename As String, ByVal dwHandle As Long, ByVal dwLen As Long, lpData As Any) As Long
Public Declare Function VirtualAlloc Lib "kernel32" (lpAddress As Any, ByVal dwSize As Long, ByVal flAllocationType As Long, ByVal flProtect As Long) As Long
Public Declare Function VirtualFree Lib "kernel32" (lpAddress As Any, ByVal dwSize As Long, ByVal dwFreeType As Long) As Long
Private Declare Function VerQueryValue Lib "Version.dll" Alias "VerQueryValueA" (pBlock As Any, ByVal lpSubBlock As String, lplpBuffer As Any, puLen As Long) As Long[/code]
April 23, 2003, 3:15 AM
Skywing
[quote author=Camel link=board=17;threadid=1131;start=0#msg8279 date=1051067720]
it seems that my (VB) checkrevision() code wont work on windows ot (9x/ME) systems--is it logical to suspect that certain kernel32 declares are responsible?
[code]Public Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, lpSecurityAttributes As SECURITY_ATTRIBUTES, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
Public Declare Function CreateFileMapping Lib "kernel32" Alias "CreateFileMappingA" (ByVal hFile As Long, lpFileMappigAttributes As SECURITY_ATTRIBUTES, ByVal flProtect As Long, ByVal dwMaximumSizeHigh As Long, ByVal dwMaximumSizeLow As Long, ByVal lpName As String) As Long
Public Declare Function MapViewOfFile Lib "kernel32" (ByVal hFileMappingObject As Long, ByVal dwDesiredAccess As Long, ByVal dwFileOffsetHigh As Long, ByVal dwFileOffsetLow As Long, ByVal dwNumberOfBytesToMap As Long) As Long
Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Public Declare Function UnmapViewOfFile Lib "kernel32" (lpBaseAddress As Any) As Long
Public Declare Function GetFileTime Lib "kernel32" (ByVal hFile As Long, lpCreationTime As FILETIME, lpLastAccessTime As FILETIME, lpLastWriteTime As FILETIME) As Long
Public Declare Function GetFileSize Lib "kernel32" (ByVal hFile As Long, lpFileSizeHigh As Long) As LongPublic Declare Function GetFileVersionInfoSize Lib "Version.dll" Alias "GetFileVersionInfoSizeA" (ByVal lptstrFilename As String, lpdwHandle As Long) As Long
Public Declare Function GetFileVersionInfo Lib "Version.dll" Alias "GetFileVersionInfoA" (ByVal lptstrFilename As String, ByVal dwHandle As Long, ByVal dwLen As Long, lpData As Any) As Long
Public Declare Function VirtualAlloc Lib "kernel32" (lpAddress As Any, ByVal dwSize As Long, ByVal flAllocationType As Long, ByVal flProtect As Long) As Long
Public Declare Function VirtualFree Lib "kernel32" (lpAddress As Any, ByVal dwSize As Long, ByVal dwFreeType As Long) As Long
Private Declare Function VerQueryValue Lib "Version.dll" Alias "VerQueryValueA" (pBlock As Any, ByVal lpSubBlock As String, lplpBuffer As Any, puLen As Long) As Long[/code]
[/quote]
As you can see from MSDN, those APIs ought to exist on Win9x as well. Perhaps you can provide more detailed information about what line(s) of code are failing?
April 23, 2003, 3:23 AM
Camel
it's hard/impossible to tell because it doesnt give any errors, the values at the end are just off
April 23, 2003, 5:35 PM
tA-Kane
There's an easy way to see where thigns get fucked up...

At the beginning of the CheckRevision, get a file (perhaps "trace.txt"), and then after every single damned line of code, you can print the new value of every variable which has changed.

(Since I don't know how VB uses files, I'll show you in REALbasic code, heopfully you'll get the idea)
For example, you could do this:[code]Sub Example()
Dim file As TextOutputStream
Dim Value1 As Integer, Value2 As Integer

file = GetFolderItem("trace.txt")
if file = nil then
msgbox "an error occured while trying to get the file"
return
end if
Value1 = 0
file.write "Value1="+Str(Value1)
Value2 = 25
file.write "Value2="+Str(Value2)
Value1=Value2+Value1*Value2+Value1
file.write "Value1="+Str(Value2)
file.close
End Sub[/code]

Then, you'd just need to run that code on the "good" operating system as well as the one that fails. After that, all you need to do is compare and see where the first inconsistency is at (you could write a small prog to do that, or do it manually... but it should be rather long to do it manually).
April 23, 2003, 7:46 PM
St0rm.iD
It looks like you mechanically ported the C version. Search for c0ol's post about how CheckRevision works, then port it using VB's 'native' file I/O system.
April 23, 2003, 11:22 PM

Search