I am trying to convert the following B3D decls function to BMAX:
However, I am struggling and have not been able to find anything on the forums specific to my problem. I thought my BMax bank references should be 'Byte Ptr' in the extern declaration, and the strings as '$z'?
but I have read that BMax strings are now objects rather than CStrings (gulp)...
In B3D I passed the values returned by CreateBank() as the bank address pointers, which worked. However, in BMax this results in an Int to Byte Ptr conversion error.
No matter what I try I cannot get this to work. I am totally confused. Can anyone point me in the right direction?
; .lib "kernel32.dll" ; GetVolumeInformation% _ ; ( _ ; lpRootPathName$, _ ; lpVolumeNameBuffer*, _ ; nVolumeNameSize%, _ ; lpVolumeSerialNumber*, _ ; lpMaximumComponentLength%, _ ; lpFileSystemFlags%, _ ; lpFileSystemNameBuffer*, _ ; nFileSystemNameSize% _ ; ):"GetVolumeInformationA" Print GetSysDiskSN%("C:") Function GetSysDiskSN%(Root$) Local APICall% Local DiskSerialNo% VolSerialNoBank = CreateBank(4) VolNameBank = CreateBank(255) VolFileSysBank = CreateBank(255) APICall%=GetVolumeInformation%(Root$,VolNameBank,BankSize(VolNameBank),VolSerialNoBank,0,0,VolFileSysBank,BankSize(VolFileSysBank)) DiskSerialNo%=PeekInt(VolSerialNoBank,0) FreeBank VolSerialNoBank FreeBank VolNameBank FreeBank VolFileSysBank Return DiskSerialNo% End Function
However, I am struggling and have not been able to find anything on the forums specific to my problem. I thought my BMax bank references should be 'Byte Ptr' in the extern declaration, and the strings as '$z'?
Extern "Win32" Function GetVolumeInformationA(.. lpRootPathName$z,.. lpVolumeNameBuffer:Byte Ptr,.. nVolumeNameSize%,.. lpVolumeSerialNumber:Byte Ptr,.. lpMaximumComponentLength%,.. lpFileSystemFlags%,.. lpFileSystemNameBuffer:Byte Ptr,.. nFileSystemNameSize%) End Extern Graphics 800,600 SetColor 255,255,255 DrawText "Serial No = "+GetSysDiskSN%("C:"),0,0 Flip WaitKey End Function GetSysDiskSN%(Root$) Local DiskSerialNo% VolSerialNoBank=CreateBank(4) VolNameBank=CreateBank(255) VolFileSysBank=CreateBank(255) GetVolumeInformationA("C:",VolNameBank,BankSize(VolNameBank),VolSerialNoBank,0,0,VolFileSysBank,BankSize(VolFileSysBank)) DiskSerialNo%=PeekInt(VolSerialNoBank,0) VolSerialNoBank=Null VolNameBank=Null VolFileSysBank=Null GCCollect Return DiskSerialNo% End Function
but I have read that BMax strings are now objects rather than CStrings (gulp)...
In B3D I passed the values returned by CreateBank() as the bank address pointers, which worked. However, in BMax this results in an Int to Byte Ptr conversion error.
No matter what I try I cannot get this to work. I am totally confused. Can anyone point me in the right direction?