News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

a test to know if a handle is a resource handle or a file handle

Started by TouEnMasm, May 22, 2013, 11:43:39 PM

Previous topic - Next topic

TouEnMasm


The test:
Quote
invoke SizeofResource, hInstance,hFile ; hfile = createfile
return 0 on XP but i am not sure it work on any system.
Thanks for testing it,if it don't work , return "BAD TEST..".
Fa is a musical note to play with CL

TouEnMasm


Seems there is many class.
To use them there is  need to create a c++ library (PROC C)who call those functions.
Fa is a musical note to play with CL

Gunther

Hi Yves,

here is my output (Windows 7, 64 bit).


GOOD TEST handle isn't a resource


Gunther
You have to know the facts before you can distort them.

Magnum

It didn't work on my XP Sp3.

<?xml version="1.0" encoding="UTF-16"?>
<DATABASE>
<EXE NAME="console.exe" FILTER="GRABMI_FILTER_PRIVACY">
    <MATCHING_FILE NAME="console.exe" SIZE="5120" CHECKSUM="0x46B5A140" MODULE_TYPE="WIN32" PE_CHECKSUM="0x0" LINKER_VERSION="0x0" LINK_DATE="05/22/2013 13:31:30" UPTO_LINK_DATE="05/22/2013 13:31:30" />
</EXE>
<EXE NAME="kernel32.dll" FILTER="GRABMI_FILTER_THISFILEONLY">
    <MATCHING_FILE NAME="kernel32.dll" SIZE="990208" CHECKSUM="0xCC2C4544" BIN_FILE_VERSION="5.1.2600.6293" BIN_PRODUCT_VERSION="5.1.2600.6293" PRODUCT_VERSION="5.1.2600.6293" FILE_DESCRIPTION="Windows NT BASE API Client DLL" COMPANY_NAME="Microsoft Corporation" PRODUCT_NAME="Microsoft® Windows® Operating System" FILE_VERSION="5.1.2600.6293 (xpsp_sp3_gdr.121001-1622)" ORIGINAL_FILENAME="kernel32" INTERNAL_NAME="kernel32" LEGAL_COPYRIGHT="© Microsoft Corporation. All rights reserved." VERFILEDATEHI="0x0" VERFILEDATELO="0x0" VERFILEOS="0x40004" VERFILETYPE="0x2" MODULE_TYPE="WIN32" PE_CHECKSUM="0xFBCBC" LINKER_VERSION="0x50001" UPTO_BIN_FILE_VERSION="5.1.2600.6293" UPTO_BIN_PRODUCT_VERSION="5.1.2600.6293" LINK_DATE="10/03/2012 04:58:13" UPTO_LINK_DATE="10/03/2012 04:58:13" VER_LANGUAGE="English (United States) [0x409]" />
</EXE>
</DATABASE>
Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

TouEnMasm


If it failed on some machine , i change it.

The value of an Handle of resource seem to be greater than the module handle (hinstance).It's not the case for Hfile handle.
The test is:

mov hFile,eax
.if eax < hInstance
invoke printf,TXT("GOOD TEST hFile isn't a resource Handle",10,0)
.else
invoke printf,TXT("BAD TEST hFile isn't a resource Handle",10,0)
.endif
invoke loadrcdatafile,2000,addr fileini
mov eax,fileini.Hmem
.if eax > hInstance
invoke printf,TXT("GOOD TEST Hres is a resource Handle",10,0)
.else
invoke printf,TXT("BAD TEST Hres is a resource Handle",10,0)
.endif
Fa is a musical note to play with CL

dedndave

xp mce2005, sp3
GOOD TEST hFile isn't a resource Handle
GOOD TEST Hres is a resource Handle

FORTRANS

Hi,

   Windows 2000. "Test_handle is not a valid WIN32 application"

Steve

Siekmanski

OS        : Windows v5.1.2600 Service Pack 3
Processor : Intel(R) Core(TM)2 Quad CPU Q6600  @ 2.40GHz

GOOD TEST hFile isn't a resource Handle
GOOD TEST Hres is a resource Handle
Creative coders use backward thinking techniques as a strategy.

TouEnMasm


The second soluce seems to work.Thanks at all for answers.
Fa is a musical note to play with CL