Author Topic: cool dll trick I found tonight  (Read 8346 times)

0 Members and 1 Guest are viewing this topic.

kryton9

  • Guest
winSDK preliminary stats
« Reply #15 on: June 07, 2012, 04:10:48 PM »
1,224 header files
267 lib files

kryton9

  • Guest
dumpbin of lib file with /ALL option
« Reply #16 on: June 07, 2012, 04:26:38 PM »
Charles, here is the output of from cmd window of Xinput.lib using dumpbin with the /ALL option. Can we pull anything useful out of this?
C:\Code\WinSDK\Lib>dumpbin /ALL Xinput.lib > _test.txt

Code: OxygenBasic
  1. Microsoft (R) COFF Binary File Dumper Version 6.00.8168
  2. Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
  3.  
  4.  
  5. Dump of file Xinput.lib
  6.  
  7. File Type: LIBRARY
  8.  
  9. Archive member name at 8: /              
  10. 4375874E time/date Sat Nov 12 01:10:22 2005
  11.          uid
  12.          gid
  13.        0 mode
  14.      188 size
  15. correct header end
  16.  
  17.     13 public symbols
  18.  
  19.       39A __IMPORT_DESCRIPTOR_XINPUT9_1_0
  20.       5D4 __NULL_IMPORT_DESCRIPTOR
  21.       710 XINPUT9_1_0_NULL_THUNK_DATA
  22.       86C _DllMain@12
  23.       86C __imp__DllMain@12
  24.       9D6 _XInputGetState@8
  25.       9D6 __imp__XInputGetState@8
  26.       A48 _XInputSetState@8
  27.       A48 __imp__XInputSetState@8
  28.       8D8 _XInputGetCapabilities@12
  29.       8D8 __imp__XInputGetCapabilities@12
  30.       952 _XInputGetDSoundAudioDeviceGuids@12
  31.       952 __imp__XInputGetDSoundAudioDeviceGuids@12
  32.  
  33. Archive member name at 1CC: /              
  34. 4375874E time/date Sat Nov 12 01:10:22 2005
  35.          uid
  36.          gid
  37.        0 mode
  38.      192 size
  39. correct header end
  40.  
  41.     8 offsets
  42.  
  43.         1      39A
  44.         2      5D4
  45.         3      710
  46.         4      86C
  47.         5      9D6
  48.         6      A48
  49.         7      8D8
  50.         8      952
  51.  
  52.     13 public symbols
  53.  
  54.         4 _DllMain@12
  55.         7 _XInputGetCapabilities@12
  56.         8 _XInputGetDSoundAudioDeviceGuids@12
  57.         5 _XInputGetState@8
  58.         6 _XInputSetState@8
  59.         1 __IMPORT_DESCRIPTOR_XINPUT9_1_0
  60.         2 __NULL_IMPORT_DESCRIPTOR
  61.         4 __imp__DllMain@12
  62.         7 __imp__XInputGetCapabilities@12
  63.         8 __imp__XInputGetDSoundAudioDeviceGuids@12
  64.         5 __imp__XInputGetState@8
  65.         6 __imp__XInputSetState@8
  66.         3 XINPUT9_1_0_NULL_THUNK_DATA
  67.  
  68. Archive member name at 39A: XINPUT9_1_0.dll/
  69. 4375874E time/date Sat Nov 12 01:10:22 2005
  70.          uid
  71.          gid
  72.        0 mode
  73.      1FE size
  74. correct header end
  75.  
  76. FILE HEADER VALUES
  77.              14C machine (i386)
  78.                3 number of sections
  79.         4375874E time date stamp Sat Nov 12 01:10:22 2005
  80.              114 file pointer to symbol table
  81.                8 number of symbols
  82.                0 size of optional header
  83.              100 characteristics
  84.                    32 bit word machine
  85.  
  86. SECTION HEADER #1
  87. .debug$S name
  88.        0 physical address
  89.        0 virtual address
  90.       46 size of raw data
  91.       8C file pointer to raw data
  92.        0 file pointer to relocation table
  93.        0 file pointer to line numbers
  94.        0 number of relocations
  95.        0 number of line numbers
  96. 42100040 flags
  97.          Initialized Data
  98.          Discardable
  99.          1 byte align
  100.          Read Only
  101.  
  102. RAW DATA #1
  103.   00000000: 02 00 00 00 16 00 09 00 00 00 00 00 0F 58 49 4E  .............XIN
  104.   00000010: 50 55 54 39 5F 31 5F 30 2E 64 6C 6C 28 00 13 10  PUT9_1_0.dll(...
  105.   00000020: 07 00 00 00 03 00 00 00 00 00 00 00 08 00 00 00  ................
  106.   00000030: 27 C6 12 4D 69 63 72 6F 73 6F 66 74 20 28 52 29  'Æ.Microsoft (R)
  107.  00000040: 20 4C 49 4E 4B 00                                 LINK.
  108.  
  109. SECTION HEADER #2
  110. .idata$2 name
  111.        0 physical address
  112.        0 virtual address
  113.       14 size of raw data
  114.       D2 file pointer to raw data
  115.       E6 file pointer to relocation table
  116.        0 file pointer to line numbers
  117.        3 number of relocations
  118.        0 number of line numbers
  119. C0300040 flags
  120.          Initialized Data
  121.          4 byte align
  122.          Read Write
  123.  
  124. RAW DATA #2
  125.   00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  126.   00000010: 00 00 00 00                                      ....
  127.  
  128. RELOCATIONS #2
  129.                                                 Symbol    Symbol
  130.  Offset    Type              Applied To         Index     Name
  131.  --------  ----------------  -----------------  --------  ------
  132.  0000000C  DIR32NB                    00000000         3  .idata$6
  133.  00000000  DIR32NB                    00000000         4  .idata$4
  134.  00000010  DIR32NB                    00000000         5  .idata$5
  135.  
  136. SECTION HEADER #3
  137. .idata$6 name
  138.        0 physical address
  139.        0 virtual address
  140.       10 size of raw data
  141.      104 file pointer to raw data
  142.       E6 file pointer to relocation table
  143.        0 file pointer to line numbers
  144.        0 number of relocations
  145.        0 number of line numbers
  146. C0200040 flags
  147.          Initialized Data
  148.          2 byte align
  149.          Read Write
  150.  
  151. RAW DATA #3
  152.   00000000: 58 49 4E 50 55 54 39 5F 31 5F 30 2E 64 6C 6C 00  XINPUT9_1_0.dll.
  153.  
  154. COFF SYMBOL TABLE
  155. 000 007BC627 ABS    notype       Static       | @comp.id
  156. 001 00000000 SECT2  notype       External     | __IMPORT_DESCRIPTOR_XINPUT9_1_0
  157. 002 C0000040 SECT2  notype       Section      | .idata$2
  158. 003 00000000 SECT3  notype       Static       | .idata$6
  159. 004 C0000040 UNDEF  notype       Section      | .idata$4
  160. 005 C0000040 UNDEF  notype       Section      | .idata$5
  161. 006 00000000 UNDEF  notype       External     | __NULL_IMPORT_DESCRIPTOR
  162. 007 00000000 UNDEF  notype       External     | XINPUT9_1_0_NULL_THUNK_DATA
  163.  
  164. String Table Size = 0x5A bytes
  165.  
  166. Archive member name at 5D4: XINPUT9_1_0.dll/
  167. 4375874E time/date Sat Nov 12 01:10:22 2005
  168.          uid
  169.          gid
  170.        0 mode
  171.       FF size
  172. correct header end
  173.  
  174. FILE HEADER VALUES
  175.              14C machine (i386)
  176.                2 number of sections
  177.         4375874E time date stamp Sat Nov 12 01:10:22 2005
  178.               BE file pointer to symbol table
  179.                2 number of symbols
  180.                0 size of optional header
  181.              100 characteristics
  182.                    32 bit word machine
  183.  
  184. SECTION HEADER #1
  185. .debug$S name
  186.        0 physical address
  187.        0 virtual address
  188.       46 size of raw data
  189.       64 file pointer to raw data
  190.        0 file pointer to relocation table
  191.        0 file pointer to line numbers
  192.        0 number of relocations
  193.        0 number of line numbers
  194. 42100040 flags
  195.          Initialized Data
  196.          Discardable
  197.          1 byte align
  198.          Read Only
  199.  
  200. RAW DATA #1
  201.   00000000: 02 00 00 00 16 00 09 00 00 00 00 00 0F 58 49 4E  .............XIN
  202.   00000010: 50 55 54 39 5F 31 5F 30 2E 64 6C 6C 28 00 13 10  PUT9_1_0.dll(...
  203.   00000020: 07 00 00 00 03 00 00 00 00 00 00 00 08 00 00 00  ................
  204.   00000030: 27 C6 12 4D 69 63 72 6F 73 6F 66 74 20 28 52 29  'Æ.Microsoft (R)
  205.  00000040: 20 4C 49 4E 4B 00                                 LINK.
  206.  
  207. SECTION HEADER #2
  208. .idata$3 name
  209.        0 physical address
  210.        0 virtual address
  211.       14 size of raw data
  212.       AA file pointer to raw data
  213.        0 file pointer to relocation table
  214.        0 file pointer to line numbers
  215.        0 number of relocations
  216.        0 number of line numbers
  217. C0300040 flags
  218.          Initialized Data
  219.          4 byte align
  220.          Read Write
  221.  
  222. RAW DATA #2
  223.   00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  224.   00000010: 00 00 00 00                                      ....
  225.  
  226. COFF SYMBOL TABLE
  227. 000 007BC627 ABS    notype       Static       | @comp.id
  228. 001 00000000 SECT2  notype       External     | __NULL_IMPORT_DESCRIPTOR
  229.  
  230. String Table Size = 0x1D bytes
  231.  
  232. Archive member name at 710: XINPUT9_1_0.dll/
  233. 4375874E time/date Sat Nov 12 01:10:22 2005
  234.          uid
  235.          gid
  236.        0 mode
  237.      11F size
  238. correct header end
  239.  
  240. FILE HEADER VALUES
  241.              14C machine (i386)
  242.                3 number of sections
  243.         4375874E time date stamp Sat Nov 12 01:10:22 2005
  244.               DA file pointer to symbol table
  245.                2 number of symbols
  246.                0 size of optional header
  247.              100 characteristics
  248.                    32 bit word machine
  249.  
  250. SECTION HEADER #1
  251. .debug$S name
  252.        0 physical address
  253.        0 virtual address
  254.       46 size of raw data
  255.       8C file pointer to raw data
  256.        0 file pointer to relocation table
  257.        0 file pointer to line numbers
  258.        0 number of relocations
  259.        0 number of line numbers
  260. 42100040 flags
  261.          Initialized Data
  262.          Discardable
  263.          1 byte align
  264.          Read Only
  265.  
  266. RAW DATA #1
  267.   00000000: 02 00 00 00 16 00 09 00 00 00 00 00 0F 58 49 4E  .............XIN
  268.   00000010: 50 55 54 39 5F 31 5F 30 2E 64 6C 6C 28 00 13 10  PUT9_1_0.dll(...
  269.   00000020: 07 00 00 00 03 00 00 00 00 00 00 00 08 00 00 00  ................
  270.   00000030: 27 C6 12 4D 69 63 72 6F 73 6F 66 74 20 28 52 29  'Æ.Microsoft (R)
  271.  00000040: 20 4C 49 4E 4B 00                                 LINK.
  272.  
  273. SECTION HEADER #2
  274. .idata$5 name
  275.        0 physical address
  276.        0 virtual address
  277.        4 size of raw data
  278.       D2 file pointer to raw data
  279.        0 file pointer to relocation table
  280.        0 file pointer to line numbers
  281.        0 number of relocations
  282.        0 number of line numbers
  283. C0300040 flags
  284.          Initialized Data
  285.          4 byte align
  286.          Read Write
  287.  
  288. RAW DATA #2
  289.   00000000: 00 00 00 00                                      ....
  290.  
  291. SECTION HEADER #3
  292. .idata$4 name
  293.        0 physical address
  294.        0 virtual address
  295.        4 size of raw data
  296.       D6 file pointer to raw data
  297.        0 file pointer to relocation table
  298.        0 file pointer to line numbers
  299.        0 number of relocations
  300.        0 number of line numbers
  301. C0300040 flags
  302.          Initialized Data
  303.          4 byte align
  304.          Read Write
  305.  
  306. RAW DATA #3
  307.   00000000: 00 00 00 00                                      ....
  308.  
  309. COFF SYMBOL TABLE
  310. 000 007BC627 ABS    notype       Static       | @comp.id
  311. 001 00000000 SECT2  notype       External     | XINPUT9_1_0_NULL_THUNK_DATA
  312.  
  313. String Table Size = 0x21 bytes
  314.  
  315. Archive member name at 86C: XINPUT9_1_0.dll/
  316. 4375874E time/date Sat Nov 12 01:10:22 2005
  317.          uid
  318.          gid
  319.        0 mode
  320.       30 size
  321. correct header end
  322.  
  323.   Version      : 0
  324.   Machine      : 14C (i386)
  325.   TimeDateStamp: 4375874E Sat Nov 12 01:10:22 2005
  326.   SizeOfData   : 0000001C
  327.   DLL name     : XINPUT9_1_0.dll
  328.   Symbol name  : _DllMain@12
  329.   Type         : code
  330.   Name type    : undecorate
  331.   Hint         : 0
  332.   Name         : DllMain
  333.  
  334. Archive member name at 8D8: XINPUT9_1_0.dll/
  335. 4375874E time/date Sat Nov 12 01:10:22 2005
  336.          uid
  337.          gid
  338.        0 mode
  339.       3E size
  340. correct header end
  341.  
  342.   Version      : 0
  343.   Machine      : 14C (i386)
  344.   TimeDateStamp: 4375874E Sat Nov 12 01:10:22 2005
  345.   SizeOfData   : 0000002A
  346.   DLL name     : XINPUT9_1_0.dll
  347.   Symbol name  : _XInputGetCapabilities@12
  348.   Type         : code
  349.   Name type    : undecorate
  350.   Hint         : 1
  351.   Name         : XInputGetCapabilities
  352.  
  353. Archive member name at 952: XINPUT9_1_0.dll/
  354. 4375874E time/date Sat Nov 12 01:10:22 2005
  355.          uid
  356.          gid
  357.        0 mode
  358.       48 size
  359. correct header end
  360.  
  361.   Version      : 0
  362.   Machine      : 14C (i386)
  363.   TimeDateStamp: 4375874E Sat Nov 12 01:10:22 2005
  364.   SizeOfData   : 00000034
  365.   DLL name     : XINPUT9_1_0.dll
  366.   Symbol name  : _XInputGetDSoundAudioDeviceGuids@12
  367.   Type         : code
  368.   Name type    : undecorate
  369.   Hint         : 2
  370.   Name         : XInputGetDSoundAudioDeviceGuids
  371.  
  372. Archive member name at 9D6: XINPUT9_1_0.dll/
  373. 4375874E time/date Sat Nov 12 01:10:22 2005
  374.          uid
  375.          gid
  376.        0 mode
  377.       36 size
  378. correct header end
  379.  
  380.   Version      : 0
  381.   Machine      : 14C (i386)
  382.   TimeDateStamp: 4375874E Sat Nov 12 01:10:22 2005
  383.   SizeOfData   : 00000022
  384.   DLL name     : XINPUT9_1_0.dll
  385.   Symbol name  : _XInputGetState@8
  386.   Type         : code
  387.   Name type    : undecorate
  388.   Hint         : 3
  389.   Name         : XInputGetState
  390.  
  391. Archive member name at A48: XINPUT9_1_0.dll/
  392. 4375874E time/date Sat Nov 12 01:10:22 2005
  393.          uid
  394.          gid
  395.        0 mode
  396.       36 size
  397. correct header end
  398.  
  399.   Version      : 0
  400.   Machine      : 14C (i386)
  401.   TimeDateStamp: 4375874E Sat Nov 12 01:10:22 2005
  402.   SizeOfData   : 00000022
  403.   DLL name     : XINPUT9_1_0.dll
  404.   Symbol name  : _XInputSetState@8
  405.   Type         : code
  406.   Name type    : undecorate
  407.   Hint         : 4
  408.   Name         : XInputSetState
  409.  
  410.      Exports
  411.  
  412.        ordinal    name
  413.  
  414.                   _DllMain@12
  415.                   _XInputGetCapabilities@12
  416.                   _XInputGetDSoundAudioDeviceGuids@12
  417.                   _XInputGetState@8
  418.                   _XInputSetState@8
  419.  
  420.   Summary
  421.  
  422.           D2 .debug$S
  423.           14 .idata$2
  424.           14 .idata$3
  425.            4 .idata$4
  426.            4 .idata$5
  427.           10 .idata$6
  428.  

kryton9

  • Guest
0ver 190,000 constants
« Reply #17 on: June 07, 2012, 04:58:23 PM »
Here is a dump from all of the header files in the latest Windows SDK without .net of all the constants. The lines ending with "\"
have even more lines of code that are not showing. Well over 190,000 lines. How do you determine the ones that are important? I am at a loss.
But still fun to look at.  

I have given you a lot to look at the last several posts. I will stop here and wait to hear from you where you would like assistance and what to work on next.

Update: The attached is the raw dump put together. Further below you will find a cleaned up version.
« Last Edit: June 07, 2012, 11:27:43 PM by kryton9 »

Charles Pegge

  • Guest
Re: cool dll trick I found tonight
« Reply #18 on: June 07, 2012, 10:17:32 PM »
This is what happens when a team of 5000 programmers spend 17 years creating an operating system :). Maybe 0.5% of it meets 99.9% of a project's requirements. As I see it, once you go beyond the basics, all the additional development resources come straight from the Web. It is the ultimate database.

It is very useful to have it all in a single file though. Looking up constants on the Web takes a lot of time.

With regard to FreeGlut and SDL etc, it should be possible to use the standard C headers with very minor extras, just like the OpenGl headers. Saves a lot of maintenance. The problem with many of these libraries is that they grow very large over the years. FreeImage, for instance is 2.5 megs, which is a bit OTT when JPEG and PNG is all you want from it.

Charles
« Last Edit: June 07, 2012, 10:23:57 PM by Charles Pegge »

kryton9

  • Guest
I just spent several hours cleaning up all the constants.
« Reply #19 on: June 07, 2012, 11:22:25 PM »
Here is best I can clean up constants Charles. It is sorted in alphabetical order, duplicates removed and any define starting with _ I commented out, they are at the beginning of the file. Almost 13,000.
The rest is lots of stuff. I am sure a lot we don't need.

One thing that surprised me in when I was cleaning up this file, the amount of header files without a header definition to ward off duplicate reads of it. Also how the naming of such defines were not standard.
You think on a project this big everything would be squeaky clean! From a world giant like Microsoft.

I just noticed after cleaning it is about half the raw file dump size :)
« Last Edit: June 07, 2012, 11:31:26 PM by kryton9 »

kryton9

  • Guest
Re: cool dll trick I found tonight
« Reply #20 on: June 07, 2012, 11:24:48 PM »
Quote
With regard to FreeGlut and SDL etc, it should be possible to use the standard C headers with very minor extras, just like the OpenGl headers. Saves a lot of maintenance.

I would say freeglut would be a good one to do. Since glut is used in so many examples and actually is pretty cool. Can you do your quick voodoo on it or should I slave on it, next?

kryton9

  • Guest
Re: cool dll trick I found tonight
« Reply #21 on: June 08, 2012, 08:11:07 AM »
After sleeping and waking up to do some more research, I realized the ConstsClean.inc file should just be used for a quick reference if ever needed. There are many things that could be removed from there that I am seeing now comparing it with the original header files. Besides we are not working on writing an operating system, so there are probably so many things that will never be used in daily programming. I guess going the VB6 route was complete enough.

kryton9

  • Guest
8K to 108K
« Reply #22 on: June 08, 2012, 10:04:26 AM »
Having an all in one approach has it draw backs. Less work in the future, but bigger exe files each time.

What before was 8K is now 108K. So all this work this week was a waste in terms of being usable, but it was a good learning experience and we have good reference material for noobs like me trying to make use of windows dll functions.

Here is an updated winBinds.inc that works. It needs winConsts.inc and winTypes.inc. It has about 5 times as many functions as winFunc.inc. This can be used for quick and dirty testing when you don't want to mess with declaring the functions.

To make it clear. You use either winBinds.inc or winFuncs.inc as your main include file. Never both. Each will include winConsts.inc and winTypes.inc automatically.

Charles Pegge

  • Guest
Re: cool dll trick I found tonight
« Reply #23 on: June 08, 2012, 11:09:04 AM »
One drawback with bind is that all the proc addresses in the list are linked in, whether they are used in the program or not. For a large list, this can add a lot unused code to a program.

Looking at FreeGlut, I doubt it adds much to what we already have. But I am going through the headers now. Oxygen gags on some of the syntax like:

typedef void (*GLUTproc)();
FGAPI GLUTproc FGAPIENTRY glutGetProcAddress( const char *procName );

kryton9

  • Guest
Re: cool dll trick I found tonight
« Reply #24 on: June 08, 2012, 04:09:36 PM »
What freeglut will add Charles is cross platform ability! 

About the size, it is just neat that oxygen can have so many ways to access dlls. How your parser handles all the different syntax boggles my mind!!!