1. NQAR2 ?? Attention MIC
- Posted by "Bernard W. Ryan" <xotron at bluefrognet.net> Nov 02, 2003
- 724 views
Mic: In your nqar2 files you have libraries example : w32kernel.lib What utility did you use to create them ? There are not standard library files. They appear to be just a list of functions What is the format that you are using ? Bernie
2. Re: NQAR2 ?? Attention MIC
- Posted by "mic _" <stabmaster_ at hotmail.com> Nov 03, 2003
- 670 views
>Mic: > In your nqar2 files you have libraries example : w32kernel.lib > What utility did you use to create them ? > There are not standard library files. > They appear to be just a list of functions > What is the format that you are using ? >Bernie > I wrote a small utility (in euphoria :) to create those. The format is as follows: CSTRING: name is needed dll file, zero-padded to the nearest 8-byte boundry. DWORD: number of entries (=n) DWORD: one (1) DWORD*n: absolute file offset of entry names WORD*n: zero (0) BYTE*n: size in bytes of the arguments for each entry (eg. compare with the notation "GetDC@4") CSTRING*n: entry names BYTE*?: zero-padding to the nearest 16-byte boundry I just wanted a simple format I could use with the compiler. One of the things on my to-do list is to add support for COFF format libs, as used by eg. MS's compilers, but I find those pretty messy and I have yet to get hold of a good spec.
3. Re: NQAR2 ?? Attention MIC
- Posted by "Bernard W. Ryan" <xotron at bluefrognet.net> Nov 03, 2003
- 642 views
> Mic wrote: > > CSTRING: name is needed dll file, zero-padded to the nearest 8-byte boundry. > DWORD: number of entries (=n) > DWORD: one (1) > DWORD*n: absolute file offset of entry names > WORD*n: zero (0) > 000000: 67 64 69 33 32 2E 64 6C 6C 00 00 00 00 00 00 00 gdi32.dll....... > 000010: 03 00 00 00 01 00 00 00 2D 00 00 00 3C 00 00 00 ........-...<... > 000020: 4A 00 00 00 00 00 00 00 00 00 04 34 04 47 65 74 J..........4.Get > 000030: 53 74 6F 63 6B 4F 62 6A 65 63 74 00 53 74 72 65 StockObject.Stre > 000040: 74 63 68 44 49 42 69 74 73 00 53 77 61 70 42 75 tchDIBits.SwapBu > 000050: 66 66 65 72 73 00 00 00 00 00 00 00 00 00 00 00 ffers........... > 000060: Mic: I don't understand your library format from this point on: > BYTE*n: size in bytes of the arguments for each entry (eg. compare with the > notation "GetDC@4") > CSTRING*n: entry names > BYTE*?: zero-padding to the nearest 16-byte boundry The size in bytes of the arguments doesn't match up or I don't understand the the format. GetStockObject arguments requires int (4 bytes) not 3C hex (60 bytes) ?? I'am very confused. Please help me clear up my thinking. Thanks Bernie
4. Re: NQAR2 ?? Attention MIC
- Posted by "mic _" <stabmaster_ at hotmail.com> Nov 03, 2003
- 641 views
> > 000000: 67 64 69 33 32 2E 64 6C 6C 00 00 00 00 00 00 00 >gdi32.dll....... > > 000010: 03 00 00 00 01 00 00 00 2D 00 00 00 3C 00 00 00 >........-...<... > > 000020: 4A 00 00 00 00 00 00 00 00 00 04 34 04 47 65 74 >J..........4.Get > > 000030: 53 74 6F 63 6B 4F 62 6A 65 63 74 00 53 74 72 65 >StockObject.Stre > > 000040: 74 63 68 44 49 42 69 74 73 00 53 77 61 70 42 75 >tchDIBits.SwapBu > > 000050: 66 66 65 72 73 00 00 00 00 00 00 00 00 00 00 00 >ffers........... > > 000060: > The size in bytes of the arguments doesn't match up or > I don't understand the the format. > > GetStockObject arguments requires int (4 bytes) not 3C hex (60 bytes) ?? > > I'am very confused. > Please help me clear up my thinking. > The argument size for GetStockObject is stored at offset 2A. The "*n" in the format description means there are n of those, not just one.
5. Re: NQAR2 ?? Attention MIC
- Posted by "Bernard W. Ryan" <xotron at bluefrognet.net> Nov 03, 2003
- 661 views
>The argument size for GetStockObject is stored at offset 2A. The "*n" in the >format description means there are n of those, not just one. Mic: I do not see the offset value 2A anywhere in the hex dump of your GDI32.LIB. How are you calculating the offset ? Are you using dumpbin, if so what parameters on the command line do you use ? Can you walk me through how you got the offset for GetStockObject and what value use in the hex dump. Sorry to ask all of these dumb questions. Bernie
6. Re: NQAR2 ?? Attention MIC
- Posted by "mic _" <stabmaster_ at hotmail.com> Nov 03, 2003
- 642 views
>000000: 67 64 69 33 32 2E 64 6C 6C 00 00 00 00 00 00 00 gdi32.dll....... >000010: 03 00 00 00 01 00 00 00 2D 00 00 00 3C 00 00 00 ........-...<... >000020: 4A 00 00 00 00 00 00 00 00 00 04 34 04 47 65 74 J..........4.Get >000030: 53 74 6F 63 6B 4F 62 6A 65 63 74 00 53 74 72 65 StockObject.Stre >000040: 74 63 68 44 49 42 69 74 73 00 53 77 61 70 42 75 tchDIBits.SwapBu >000050: 66 66 65 72 73 00 00 00 00 00 00 00 00 00 00 00 ffers........... >000060: Offset 2A is 2 rows down, 10 (A) steps to the right. padded dll name: 16 bytes number of entries: 1 dword (4 bytes) static dword (set to #00000001): 1 dword (4 bytes) entry name offset table: 3 (in this case, since gdi32.lib has 3 entries) dwords (12 bytes) padding: 3 words (one word per entry) (6 bytes) Total = 16+4+4+12+6 = 42 = 2A bytes So at offset 2A (or 42 in decimal) you'll find the argument size table (one byte per entry). Since GetStockObject is the first entry in this case you'll find it at offset 2A+0 (=2A), while the actual name is found at offset 2D, as seen in the entry name offset table. Also note that entries are sorted alphabetically. This is because a binary search is preferred when looking up names in the linking phase. The linker will basically just try to match an unresolved symbol against the entries in all libraries that has been included by the program. If a match is found, the entry is added to the executable's import table so that the dll will be loaded and the function linked as the program is started.
7. Re: NQAR2 ?? Attention MIC
- Posted by "Bernard W. Ryan" <xotron at bluefrognet.net> Nov 04, 2003
- 773 views
>000000: 67 64 69 33 32 2E 64 6C 6C 00 00 00 00 00 00 00 gdi32.dll....... >000010: 03 00 00 00 01 00 00 00 2D 00 00 00 3C 00 00 00 ........-...<... >000020: 4A 00 00 00 00 00 00 00 00 00 04 34 04 47 65 74 J..........4.Get >000030: 53 74 6F 63 6B 4F 62 6A 65 63 74 00 53 74 72 65 StockObject.Stre >000040: 74 63 68 44 49 42 69 74 73 00 53 77 61 70 42 75 tchDIBits.SwapBu >000050: 66 66 65 72 73 00 00 00 00 00 00 00 00 00 00 00 ffers........... >000060 Mic: I still do not understand what the values from 0C through 29 (excluding the zero word) represent. Where is the 2A offset calculation placed in the header ? The reason I am trying to understand the format is that I would like to try adding to the code and a user has to be able to add more library functions. Is there any chance that you will include your library utility with your code with your next update of your code ? Bernie
8. Re: NQAR2 ?? Attention MIC
- Posted by "mic _" <stabmaster_ at hotmail.com> Nov 04, 2003
- 699 views
I've put the makelib tool up for grabs at http://nangijala.no-ip.org/nqalib.zip makelib reads files looking like this: user32.dll _AppendMenuA@16 _BeginPaint@8 _CreateMenu@0 .......... and spits out a .lib file. I've included the source files for kernel32, user32, gdi32 and comdlg32 (they're more convenient to edit than the actual .lib files).
9. Re: NQAR2 ?? Attention MIC
- Posted by "Bernard W. Ryan" <xotron at bluefrognet.net> Nov 04, 2003
- 678 views
Mic: Thank You !!!!!!! I have downloaded it. Thank You for all of your time and trouble. Bernie
10. Re: NQAR2 ?? Attention MIC
- Posted by "Bernard W. Ryan" <xotron at bluefrognet.net> Nov 07, 2003
- 660 views
MIC: The utility makelib.ex does not generate the same library format as the libraries that come with NQAR2. If I look at the libs that are generated there is no offset table etc... I just get this if I run makelib.ex using GDI32.TXT : > 000000: 67 64 69 33 32 2E 64 6C 6C 0A 5F 47 65 74 53 74 gdi32.dll._GetSt > 000010: 6F 63 6B 4F 62 6A 65 63 74 40 34 0A 5F 53 74 72 ockObject at 4._Str > 000020: 65 74 63 68 44 49 42 69 74 73 40 35 32 0A 5F 53 etchDIBits at 52._S > 000030: 77 61 70 42 75 66 66 65 72 73 40 34 0A 00 00 00 wapBuffers at 4.... > 000040: 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 ................ Bernie
11. Re: NQAR2 ?? Attention MIC
- Posted by "mic _" <stabmaster_ at hotmail.com> Nov 07, 2003
- 667 views
Seems like there are some problems with the linefeeds. I don't remeber that happening before... Change read_line() in makelib.ex to this and it should work: function read_line(integer infile) integer read,ch currLine = {} read = 0 while 1 do ch = getc(infile) if ch = -1 then exit elsif ch = #0A then ch = getc(infile) exit elsif ch != #0D then currLine &= ch read += 1 end if end while return read end function