darkjohn20 Posted March 29, 2010 Share Posted March 29, 2010 Alright, I will start by saying I HAVE looked at the DllCall section in the Help File. Now, there are some Return Types that I don't see exactly in the Help File, particularly: HMODULE BOOL and I was wondering if these might be: PTR BYTE Is this correct? Is there a place that lists these and possibly more than these? Any clarification on these types would be greatly appreciated. Also, how do you know when to use :cdecl? What determines whether it is used or not? Thank you in advance. Link to comment Share on other sites More sharing options...
JohnOne Posted March 29, 2010 Share Posted March 29, 2010 Well Bool is certainly there, dont know about hModule, msdn says handle to a dll. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Richard Robertson Posted March 29, 2010 Share Posted March 29, 2010 Those types would be about right. As for cdecl, you have to know the setup of the dll. If you see something like WINAPI, it's probably stdcall. If you see something like extern "C", it's probably cdecl. Well documented files will have this info somewhere. Link to comment Share on other sites More sharing options...
darkjohn20 Posted March 29, 2010 Author Share Posted March 29, 2010 In the case of Kernel32.dll, I am using MSDN for help. Will it specify, or should I assume one over the other? Link to comment Share on other sites More sharing options...
trancexx Posted March 29, 2010 Share Posted March 29, 2010 bool is bool (or int or long). It's not boolean (byte). darkjohn20, new AutoIt, upgrade. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
darkjohn20 Posted March 29, 2010 Author Share Posted March 29, 2010 (edited) bool is bool (or int or long). It's not boolean (byte).darkjohn20, new AutoIt, upgrade.Oops, I ALWAYS forget to run help in Beta mode...I see it now. Thanks!So, would hMODULE be handle then? Edited March 29, 2010 by darkjohn20 Link to comment Share on other sites More sharing options...
darkjohn20 Posted March 29, 2010 Author Share Posted March 29, 2010 (edited) Here is some code I have so far for a resource project I am working on (you may have read my other post). #RequireAdmin #include <Array.au3> $cEnumResTypeProc = DllCallbackRegister("_EnumResTypeProc", "bool", "handle;str;lparam") $Kernel32 = DllOpen("Kernel32.dll") ConsoleWrite("DLL: " & $Kernel32 & @CRLF) $hFileName = FileOpenDialog("Find File", @WorkingDir, "Executable (*.exe)", 3) ConsoleWrite("Path: " & $hFileName & @CRLF) $hLoadLibrary = DllCall($Kernel32, "handle", "LoadLibrary", "str", $hFileName) _ArrayDisplay($hLoadLibrary, "hLoadLibrary") $EnumResourceTypes = DllCall($Kernel32, "bool", "EnumResourceTypes", "handle", $hLoadLibrary[0], "ptr", DllCallbackGetPtr($cEnumResTypeProc), "lparam", 0) _ArrayDisplay($EnumResourceTypes, "EnumResourceTypes") DllCallbackFree($cEnumResTypeProc) Func _EnumResTypeProc($hMODULE, $lpssType, $lParam) ConsoleWrite("Type: " & $lpssType & @CRLF) Return True EndFunc It doesn't work, and I can't figure out why. It freezes on EnumResourceTypes. Any ideas? Thanks. To be clear, there is no response from _EnumResTypeProc(), so it must be a problem before that? Edited March 30, 2010 by darkjohn20 Link to comment Share on other sites More sharing options...
Ascend4nt Posted March 30, 2010 Share Posted March 30, 2010 (edited) This is wrong: $cEnumResTypeProc = DllCallbackRegister("_EnumResTypeProc", "bool", "handle;str;lparam") It should be: $cEnumResTypeProc = DllCallbackRegister("_EnumResTypeProc", "bool", "handle;ptr;lparam") And the callback should be: Func _EnumResTypeProc($hMODULE, $pStrOrResource, $lParam) And from there you need to determine if its a resource ID, or a pointer to a string. If it's a string pointer, you'll need to use DLLStructCreate() with the pointer.. problem is figuring out the string length.. you can experiment I guess with different sizes *edit (2nd time!) - copying and pasting screws things up haha - had to use a popup window this time Edited March 30, 2010 by Ascend4nt My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
darkjohn20 Posted March 30, 2010 Author Share Posted March 30, 2010 (edited) There is a print buffer mentioned in an example on MSDN: TCHAR szBuffer[80]; // print buffer for info file Perhaps that is a suggested size? Edit: You can't use AutoIt tags on links (blue words) already inside AutoIt tags, because it gets the html code used to make that a link. You can remove everything between the "[" and "]", including those and it will be fine. I have this so far, but it freezes on DllStructCreate, so I know I'm doing it wrong: Func _EnumResTypeProc($hMODULE, $lpssType, $lParam) $Is_IntResource = DllCall($Kernel32, "bool", "IS_INTRESOURCE", "word", $lpssType) If $Is_IntResource = True Then ConsoleWrite($lpssType & " is an IntResource" & @CRLF) ElseIf $Is_IntResource = False Then ConsoleWrite($lpssType & " is not an IntResource" & @CRLF) $Struct = DllStructCreate("char buffer[80]", $lpssType) ConsoleWrite("DLL Struct Data: " & DllStructGetData($Struct, "buffer") & @CRLF) EndIf $Struct = 0 Return True EndFunc Would I place a DllStructCreate in when Is_IntResource is False? Edited March 30, 2010 by darkjohn20 Link to comment Share on other sites More sharing options...
Ascend4nt Posted March 30, 2010 Share Posted March 30, 2010 (edited) IS_INTRESOURCE is a macro, which means it's not code that you can call, but a simple equation. Here's the definition from Winuser.h: #define IS_INTRESOURCE(_r) ((((ULONG_PTR)(_r)) >> 16) == 0) Basically that means this:If BitShift($lpssType,16)=0 Then ConsoleWrite($lpssType & " is an IntResource" & @CRLF) Else ConsoleWrite($lpssType & " is not an IntResource - but we still need to check the string for a #xxx" & @CRLF) $Struct = DllStructCreate("char var1[80]",$lpssType) $string=DllStructGetData($Struct,1) ; CHECK for #xxx in string for a resource #, otherwise, it should be a regular string - and then do what you will EndIf Edited March 30, 2010 by Ascend4nt My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
darkjohn20 Posted March 30, 2010 Author Share Posted March 30, 2010 Alright, I tried what you gave me, and this is the output (in this case anyways): 0x00000002 is an IntResource 0x00000003 is an IntResource 0x00000005 is an IntResource 0x0000000E is an IntResource 0x00000010 is an IntResource 0x00000018 is an IntResource What happens if it IS an IntResource? And what do I do if it ISN'T an IntResource and IS a Resource Number? I'll do some more reading by myself for now. Link to comment Share on other sites More sharing options...
Ascend4nt Posted March 30, 2010 Share Posted March 30, 2010 haha, I goofed - the one line should read:$string=DllStructGetData($Struct,1)Also - you might want to make sure this is all Unicode. In other words, call "EnumResourceTypesW" and use "wchar[80]" for the structure.As far as the rest - I've never messed with Resource stuff (and don't have a need to), so someone else would have to help you there. My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
darkjohn20 Posted March 30, 2010 Author Share Posted March 30, 2010 (edited) Alright, thanks. I'll continue reading to see if any of the information I currently have has a specific use that I haven't read about yet (such as a direct place to "insert" a Resource #).Thanks again.Edit:Hey, hey. This might have something to do with that resource number, no? http://msdn.microsoft.com/en-us/library/ms648029%28VS.85%29.aspxI still don't quite get macros. I understand the one you explained, but I'm not sure what to do with this. But, I can't be spoon-fed everything! Edited March 30, 2010 by darkjohn20 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now