I am working on making a procedure for this.

I can't figure out how to figure out what to use for parameters.



;  ; HANDLE GetMessageResources()
;  ; {
;  ;     HANDLE hResources = NULL;
;  ;
;  ;     hResources = LoadLibraryEx(RESOURCE_DLL, NULL, LOAD_LIBRARY_AS_IMAGE_RESOURCE | LOAD_LIBRARY_AS_DATAFILE);
;  ;     if (NULL == hResources)
;  ;     {
;  ;         wprintf(L"LoadLibrary failed with %lu.\n", GetLastError());
;  ;     }
;  ;
;  ;     return hResources;
;  ; }

; Local prototypes

; item_name proc arg1:DWORD,arg2:DWORD
;
; 1. item_name The procedure name
; 2. proc      Tell the assembler that this is a procedure
; 3. arg1      The name used for the parameter
; 4. :DWORD    The size of the data passed as a parameter

GetMessageResources   PROTO

.CONST

.DATA

.DATA?

.CODE

invoke GetMessageResources,

GetMessageResources proc


GetMessageResources endp


Posted on 2011-01-28 05:09:05 by skywalker
GetMessageResources has no parameters.

LoadLibraryEx has as parameters RESOURCE_DLL, NULL, LOAD_LIBRARY_AS_IMAGE_RESOURCE | LOAD_LIBRARY_AS_DATAFILE

Posted on 2011-01-28 13:22:50 by JimmyClif

GetMessageResources has no parameters.

LoadLibraryEx has as parameters RESOURCE_DLL, NULL, LOAD_LIBRARY_AS_IMAGE_RESOURCE | LOAD_LIBRARY_AS_DATAFILE




I have made the resource_dll that is referenced above. (had to re-install the 2003 PSDK)

Still working on the proc.



Attachments:
Posted on 2011-01-28 20:22:26 by skywalker
It is an empty dll..  it should have a message table resource section in it...
Posted on 2011-01-28 21:18:09 by Gunner
This is the batch file I use to create message only dlls:


mc ml.mc
rc -r ml.rc
"k:\WinDDK\7600.16385.1\bin\x86\x86\link.exe" -dll -noentry -out:ml.dll ml.res


of course the path to link.exe should point to yours :-)
Posted on 2011-01-28 21:20:53 by Gunner
Thanks.

This project may do something different that I was hoping for, but I will finish it.

I like learning new things.



Posted on 2011-01-28 22:08:40 by skywalker
This is what I have so far.

Long way to go.


;  ; HANDLE GetMessageResources()
;  ; {
;  ;    HANDLE hResources = NULL;
;  ;
;  ;    hResources = LoadLibraryEx(RESOURCE_DLL, NULL, LOAD_LIBRARY_AS_IMAGE_RESOURCE | LOAD_LIBRARY_AS_DATAFILE);
;  ;    if (NULL == hResources)
;  ;    {
;  ;        wprintf(L"LoadLibrary failed with %lu.\n", GetLastError());
;  ;    }
;  ;
;  ;    return hResources;
;  ; }

; Local prototypes

GetMessageResources  PROTO

.DATA

LL_Failed      db  "LoadLibrary failed with",0
RESOURCE_DLL  db  "c:\masm32\source\Provider.dll",0
FormatString db "%s", 0
OutputBuffer db 50 dup (0)

.DATA?

hwnd    HWND  ?

.CODE

start:

invoke GetMessageResources

invoke ExitProcess,0

GetMessageResources proc

invoke LoadLibraryEx,RESOURCE_DLL, NULL, LOAD_LIBRARY_AS_IMAGE_RESOURCE OR LOAD_LIBRARY_AS_DATAFILE

.if EAX == 0

invoke wsprintf, ADDR OutputBuffer, ADDR FormatString, ADDR LL_Failed

.ELSE

.endif

ret

GetMessageResources endp

Posted on 2011-01-29 08:51:40 by skywalker
I think I have successfully converted this to a working procedure.

Just saw that I haven't converted "return hResources;"


;  ; HANDLE GetMessageResources()
;  ; {
;  ;    HANDLE hResources = NULL;
;  ;
;  ;    hResources = LoadLibraryEx(RESOURCE_DLL, NULL, LOAD_LIBRARY_AS_IMAGE_RESOURCE | LOAD_LIBRARY_AS_DATAFILE);
;  ;    if (NULL == hResources)
;  ;    {
;  ;        wprintf(L"LoadLibrary failed with %lu.\n", GetLastError());
;  ;    }
;  ;
;  ;    return hResources;
;  ; }

; Local prototypes

GetMessageResources  PROTO

.DATA

LL_Failed            db  "LoadLibrary failed with",0
RESOURCE_DLL  db  "c:\masm32\source\Provider.dll",0
No_Resource      db  "Provider.dll is not present !",0
AppName            db  "SiegeWorks",0

;format    db  '%s', 0
;FormatString db "%s", 0
;OutputBuffer db 50 dup (0)

.DATA?

hwnd    HWND  ?


.CODE

start:

invoke GetMessageResources

invoke ExitProcess,0

GetMessageResources proc

;invoke LoadLibraryEx,RESOURCE_DLL, NULL, LOAD_LIBRARY_AS_IMAGE_RESOURCE OR LOAD_LIBRARY_AS_DATAFILE
invoke LoadLibraryEx,offset RESOURCE_DLL, NULL, LOAD_LIBRARY_AS_IMAGE_RESOURCE OR LOAD_LIBRARY_AS_DATAFILE

; Could not get this to work, go to plan b :-)
;invoke wsprintf, ADDR OutputBuffer, ADDR FormatString, ADDR LL_Failed

.if eax == NULL ;If the function fails, the return value is zero
  invoke  MessageBox, NULL, addr No_Resource, addr AppName, MB_OK

.ELSE

invoke GetLastError

.endif

ret

GetMessageResources endp

end start

Posted on 2011-01-29 17:44:25 by skywalker

;  ; HANDLE GetMessageResources()
;  ; {
;  ;     HANDLE hResources = NULL;
;  ;
;  ;     hResources = LoadLibraryEx(RESOURCE_DLL, NULL, LOAD_LIBRARY_AS_IMAGE_RESOURCE | LOAD_LIBRARY_AS_DATAFILE);
;  ;     if (NULL == hResources)
;  ;     {
;  ;         wprintf(L"LoadLibrary failed with %lu.\n", GetLastError());
;  ;     }
;  ;
;  ;     return hResources;
;  ; }


LL_Failed      db  "LoadLibrary failed with error code: %lu ",0
OutputBuffer db 128 dup (0)

GetMessageResources proc
invoke LoadLibraryEx,offset RESOURCE_DLL, NULL, LOAD_LIBRARY_AS_IMAGE_RESOURCE OR LOAD_LIBRARY_AS_DATAFILE
.IF eax == NULL
  invoke GetLastError
  invoke wsprintf, addr OutputBuffer, addr LL_Failed, eax
  invoke  MessageBox, NULL, addr OutputBuffer, addr AppName, MB_OK
.ENDIF
ret
GetMessageResources endp



Straight convert - Not Tested - Where did you get the FormatString from? Why put the GetLastError inside ELSE? Remember: An If Block Starts at { and ends at }. Also when you copy do not start replacing %lu with %s. Occasionally opening the msdn and reading up on API's would not hurt either.

wsprintf >> http://msdn.microsoft.com/en-us/library/ms647550(v=vs.85).aspx
loadlibrary >> http://msdn.microsoft.com/en-us/library/ms684175(v=vs.85).aspx
getlasterror >> http://msdn.microsoft.com/en-us/library/ms679360(v=vs.85).aspx
Posted on 2011-01-29 20:03:32 by JimmyClif
I use win32.hlp as well as MSDN.

Your code worked fine.

I have attached the provider.dll.



Attachments:
Posted on 2011-01-29 21:15:04 by skywalker