Ragdog gave me this code.
He says it works on his system, but it doesn't on mine.
I get ERROR_RESOURCE_DATA_NOT_FOUND.
Can someone PLEASE help with this?
Posted on 2010-05-04 18:55:11 by skywalker
He says it works on his system, but it doesn't on mine.
I get ERROR_RESOURCE_DATA_NOT_FOUND.
Can someone PLEASE help with this?
; With USB stick in F: drive...
; ERROR_RESOURCE_DATA_NOT_FOUND
; 1812 (0x714)
;
; from ragdog
;
.386
.model flat, stdcall ;32 bit memory model
option casemap :none ;case sensitive
include DlgMain.inc
.code
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke InitCommonControls
invoke DialogBoxParam,hInstance,IDD_DIALOG,NULL,addr DlgProc,NULL
invoke ExitProcess,0
DlgProc proc hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
.if uMsg==WM_INITDIALOG
.elseif uMsg == WM_DEVICECHANGE
mov eax,wParam
.if eax == DBT_DEVICEARRIVAL
mov eax,lParam
assume eax:ptr _DEV_BROADCAST_HDR
mov eax,.dbch_devicetype
assume eax:nothing
.if eax == DBT_DEVTYP_VOLUME
mov eax,lParam
assume eax:ptr _DEV_BROADCAST_VOLUME
mov edx,.dbcv_unitmask
;mov ecx,.dbcv_flags
xor ebx,ebx
.while ebx<26
mov ecx,edx
and edx,01h
.if edx==1
mov cx,word ptr .dbcv_flags
.if cx == 00h ;(subst net use)
add ebx,65d
invoke CheckUsbDisk,ebx
.endif
.break
.else
mov edx,ecx
shr edx,1
.endif
inc ebx
.endw
assume eax:nothing
.endif
.endif
.elseif uMsg==WM_COMMAND
.if wParam==9000
.endif
.elseif uMsg==WM_CLOSE
invoke EndDialog,hWnd,0
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
DlgProc endp
CheckUsbDisk proc uses ebx esi edi disk:dword
LOCAL buffer[128]:byte
LOCAL hDisk:dword
LOCAL notuse:dword
LOCAL Query:STORAGE_PROPERTY_QUERY
LOCAL DevDesc:STORAGE_DEVICE_DESCRIPTOR
; from .data
;disk3 db '\\.\',0
;mao db ':',0
invoke lstrcpy,addr buffer,offset disk3 ;buffer=\\.\
invoke lstrcat,addr buffer,addr disk ;buffer=\\.\X
invoke lstrcat,addr buffer,offset mao ;buffer=\\.\X:
invoke CreateFile,addr buffer, NULL, NULL,NULL, OPEN_EXISTING, NULL,NULL
mov hDisk,eax
.if eax !=INVALID_HANDLE_VALUE
mov Query.PropertyId,StorageDeviceProperty
mov Query.QueryType,PropertyStandardQuery
invoke DeviceIoControl,hDisk,IOCTL_STORAGE_QUERY_PROPERTY,addr Query, sizeof STORAGE_PROPERTY_QUERY,addr DevDesc,sizeof STORAGE_DEVICE_DESCRIPTOR,addr notuse, NULL
.if eax != NULL
mov eax,[ DevDesc.BusType]
.if eax == BusTypeUsb
invoke lstrcpy,addr buffer,addr disk ;buffer=X
invoke lstrcat,addr buffer,offset mao ;buffer=X:
invoke GetDriveType,addr buffer
.if eax != DRIVE_REMOVABLE
invoke MessageBox,0,addr buffer,addr buffer,MB_OK
.endif
.endif
.endif
.endif
invoke CloseHandle,hDisk
ret
CheckUsbDisk endp
end start
And the .inc file.
Code:
; dlgmain.inc From ragdog
;
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
include \masm32\include\Comctl32.inc
include \masm32\include\shell32.inc
INCLUDE \masm32\include\gdi32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\Comctl32.lib
includelib \masm32\lib\shell32.lib
includelib \masm32\lib\gdi32.lib
include \masm32\macros\macros.asm
CTEXT MACRO text:VARARG
local TxtName
.data
TxtName BYTE text,0
.code
EXITM <offset TxtName>
ENDM
CTL_CODE MACRO DeviceType:=<0>, Function:=<0>, Method:=<0>, Access:=<0>
EXITM %(((DeviceType) SHL 16) OR ((Access) SHL 14) OR ((Function) SHL 2) OR (Method))
ENDM
DlgProc PROTO :HWND,:UINT,:WPARAM,:LPARAM
CheckUsbDisk proto :dword
.const
IDD_DIALOG equ 1000
DBT_DEVICEARRIVAL equ 8000h
DBT_DEVTYP_VOLUME equ 02h
_DEV_BROADCAST_HDR struct
dbch_size dd ?
dbch_devicetype dd ?
dbch_reserved dd ?
_DEV_BROADCAST_HDR ends
_DEV_BROADCAST_VOLUME struct
dbcv_size dd ?
dbcv_devicetype dd ?
dbcv_reserved dd ?
dbcv_unitmask dd ?
dbcv_flags dw ?
_DEV_BROADCAST_VOLUME ends
DBTF_MEDIA equ 01h
DBTF_NET equ 02h ;subst
FILE_ANY_ACCESS equ 0
METHOD_BUFFERED equ 0
FILE_DEVICE_MASS_STORAGE equ 2dh ;from ntddk.inc
IOCTL_STORAGE_BASE equ FILE_DEVICE_MASS_STORAGE ;from ntddstor.inc
IOCTL_STORAGE_QUERY_PROPERTY equ CTL_CODE(IOCTL_STORAGE_BASE, 500h, METHOD_BUFFERED, FILE_ANY_ACCESS)
BusTypeUsb equ 7
StorageDeviceProperty equ 0
PropertyStandardQuery equ 0
STORAGE_PROPERTY_QUERY struct
PropertyId dd ? ;
QueryType dd ? ;
AdditionalParameters dd ? ;
STORAGE_PROPERTY_QUERY ends
STORAGE_DEVICE_DESCRIPTOR struct
Version dd ?
theSize dd ?
DeviceType db ?
DeviceTypeModifier db ? ; SCSI-2
RemovableMedia db ?
CommandQueueing db ?
VendorIdOffset dd ?
ProductIdOffset dd ?
ProductRevisionOffset dd ?
SerialNumberOffset dd ?
BusType dd ?
RawPropertiesLength dd ?
RawDeviceProperties dd ?
STORAGE_DEVICE_DESCRIPTOR ends
.data
disk3 db '\\.\',0
mao db ':',0
.data?
hInstance dd ?
; dlgmain.inc From ragdog
;
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
include \masm32\include\Comctl32.inc
include \masm32\include\shell32.inc
INCLUDE \masm32\include\gdi32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\Comctl32.lib
includelib \masm32\lib\shell32.lib
includelib \masm32\lib\gdi32.lib
include \masm32\macros\macros.asm
CTEXT MACRO text:VARARG
local TxtName
.data
TxtName BYTE text,0
.code
EXITM <offset TxtName>
ENDM
CTL_CODE MACRO DeviceType:=<0>, Function:=<0>, Method:=<0>, Access:=<0>
EXITM %(((DeviceType) SHL 16) OR ((Access) SHL 14) OR ((Function) SHL 2) OR (Method))
ENDM
CTL_CODE MACRO DeviceType:=<0>, Function:=<0>, Method:=<0>, Access:=<0>
EXITM %(((DeviceType) SHL 16) OR ((Access) SHL 14) OR ((Function) SHL 2) OR (Method))
ENDM
DlgProc PROTO :HWND,:UINT,:WPARAM,:LPARAM
CheckUsbDisk proto :dword
.const
IDD_DIALOG equ 1000
DBT_DEVICEARRIVAL equ 8000h
DBT_DEVTYP_VOLUME equ 02h
_DEV_BROADCAST_HDR struct
dbch_size dd ?
dbch_devicetype dd ?
dbch_reserved dd ?
_DEV_BROADCAST_HDR ends
_DEV_BROADCAST_VOLUME struct
dbcv_size dd ?
dbcv_devicetype dd ?
dbcv_reserved dd ?
dbcv_unitmask dd ?
dbcv_flags dw ?
_DEV_BROADCAST_VOLUME ends
DBTF_MEDIA equ 01h
DBTF_NET equ 02h ;subst
FILE_ANY_ACCESS equ 0
METHOD_BUFFERED equ 0
FILE_DEVICE_MASS_STORAGE equ 2dh ;from ntddk.inc
IOCTL_STORAGE_BASE equ FILE_DEVICE_MASS_STORAGE ;from ntddstor.inc
IOCTL_STORAGE_QUERY_PROPERTY equ CTL_CODE(IOCTL_STORAGE_BASE, 500h, METHOD_BUFFERED, FILE_ANY_ACCESS)
BusTypeUsb equ 7
StorageDeviceProperty equ 0
PropertyStandardQuery equ 0
STORAGE_PROPERTY_QUERY struct
PropertyId dd ? ;
QueryType dd ? ;
AdditionalParameters dd ? ;
STORAGE_PROPERTY_QUERY ends
STORAGE_DEVICE_DESCRIPTOR struct
Version dd ?
theSize dd ?
DeviceType db ?
DeviceTypeModifier db ? ; SCSI-2
RemovableMedia db ?
CommandQueueing db ?
VendorIdOffset dd ?
ProductIdOffset dd ?
ProductRevisionOffset dd ?
SerialNumberOffset dd ?
BusType dd ?
RawPropertiesLength dd ?
RawDeviceProperties dd ?
STORAGE_DEVICE_DESCRIPTOR ends
.data
disk3 db '\\.\',0
mao db ':',0
.data?
hInstance dd ?
Posted on 2010-05-04 18:55:11 by skywalker
Error name:
ERROR_RESOURCE_DATA_NOT_FOUND
Error value:
0x00000714 (1812)
Description:
The specified image file did not contain a resource section.
Did you create a dialog box, compile the .rc and link the .res file to your app? Sounds like you didn't, try doing that and it should work.
Error name:
ERROR_RESOURCE_DATA_NOT_FOUND
Error value:
0x00000714 (1812)
Description:
The specified image file did not contain a resource section.
Did you create a dialog box, compile the .rc and link the .res file to your app? Sounds like you didn't, try doing that and it should work.
I don't know what a dialog box is.
I used the code I was given.
I did not get any error message during assembly, so I honestly don't know what to do next.
Thanks,
Andy
There should be a .RC file containing a list of 'resources' to be embedded in the exe.
Resources are just some kind of data (from a file or otherwise) embedded in your app.
Resources can be absolutely anything that your exe needs.
You don't NEED to use resources - theres always another way - but this source is using resources.
Resources are just some kind of data (from a file or otherwise) embedded in your app.
Resources can be absolutely anything that your exe needs.
You don't NEED to use resources - theres always another way - but this source is using resources.