Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

141 lines
8.0 KiB

  1. Welcome to Godot, the Unicode Layer for Windows 9x!
  2. The GODOT subdirectory builds the actual DLL.
  3. The DELAY subdirectory builds the LIB file that should be shipped with the DLL. This LIB file acts as the custom
  4. loader that gives the same functionality as DELAYLOAD without forcing us to keep others from delay loading. Do NOT
  5. use the LIB file from the GODOT subdirectory!
  6. ----------------------------------------------
  7. Random Notes:
  8. We have *no* CRT dependency, thus the SOURCES files in both subdirs has "USE_NOLIBS=1". If you unintentionally add a
  9. dependency, this will explain why you broke the build. Also, we set "NOT_LEAN_AND_MEAN=1" for the DLL since we need
  10. all the extra types for our types db.
  11. Here is a quick glance at how the build works:
  12. (1) GenThnk is used in the GODOT subdirectory to build both our thunking file that contains all of the APIs (GODOT\Win9xU.c)
  13. and our failure templates (failure.c and failure.h)
  14. (2) The loader template (DELAY\thunk_stub.c) is used to generate a seperate file for *each* API we wrap. We then compile each
  15. of those files (making use of the failure.c/failure.h that was generated in #1, above. It is done this way to avoid duplicate
  16. definition warnings.
  17. (3) The DLL itself is then compiled and linked, in GODOT\$(O)
  18. (4) The loader LIB is compiled, in DELAY\$(O)
  19. (5) Note that several APIs (24 altogether) are wrapped but have no implementation; they basically just call the "W" stub. This
  20. is to facilliate the customer's ability to override the API. A brave soul could decide to implement these functions at a later
  21. date if they wanted to.
  22. (6) TEST changes have been checked into both the COMMONTEST and PUBLICTEST depots, under the GODOTUNICODELAYER environment flag.
  23. ----------------------------------------------
  24. TO ADD A DLL:
  25. (1) Add the DLL name to to godot\api.lst, preprended by a semicolon. ex:
  26. ;kernel32.dll
  27. ----------------------------------------------
  28. TO ADD AN API:
  29. (1) For "W" APIs, add the undecorated API name to godot\api.lst. This list is alphabetical under the DLL
  30. name. For "A" APIs, including "A", and for undecorated ones just put them in straight. ex:
  31. EnableWindow
  32. GetWindowLongA
  33. GetWindowLong
  34. (2) If the API is never decorated (no A/W version) or A decorated then modify bldfiles.pl to properly
  35. autogenerate. Search for where $stUndecorated is used in the Perl script, and try not to make fun of my very
  36. meager Perl talents. Note that you *will* need special handling for any function in this category (see #4 below).
  37. (3) Add the API to delay\apithnk.lst. This list MUST be alphabetical in order of dll and case-sensitive full name of
  38. the function. Ex:
  39. .dll,kernel32,SetVolumeLabelW, _SetVolumeLabelW@8
  40. .dll,kernel32,WriteProfileStringW, _WriteProfileStringW@12
  41. .dll,kernel32,lstrcatW, _lstrcatW@8
  42. .dll,mpr,MultinetGetConnectionPerformanceW, _MultinetGetConnectionPerformanceW@8
  43. Note that uppercase W comes before lowercase l, above. You can get the actual full API name the same way we did, from
  44. a "link �dump �exports <dll>" call.
  45. (4) If any special handling is required, then create an [EFunc] template for the API in GODOT\unicows.tpl, which
  46. will be used instead of the autogenerated one. See any of the 250+ [EFunc] entries in Unicows.tpl for details.
  47. (5) If any special failure handling is required (rare), then you will create an [EFunc] template in GODOT\failure.tpl.
  48. The failure function is what will be called any time the API load fails (unlikely but possible in low memory situations).
  49. The failure call should mimic the way the OS stubs out unimplemented APIs. For an example, see any of the few failure
  50. templates in that file. Note that when the customer compiles against unicows.lib (which contains over 400 of these stubs,
  51. the linker will optimize this into less than 12-15 function calls since there are only so many diffrent failure functions.
  52. Optimizing for either size or speed will cause this to happen. The reason that unicows.lib is so large is that we are doing
  53. ahead of time what the linker would usually do at link time.
  54. ----------------------------------------------
  55. CONSIDERs for future implementers/owners:
  56. (1) Currently we are not wrapping the "A" messaging functions. The side effect of this is that there are times when we
  57. will do A->W->A conversions when we could have skipped the conversions altogether and kept is as ANSI. We could wrap those
  58. functions, instead, and avoid the hassle. See GodotDoCallback for an example of a case where we *do*
  59. this - for ANSI windows receiving a message. Another example can be seen in GodotTransmitMessage/TransmitHelper for Unicode
  60. windows.
  61. (2) We currently use a similar strategy for our own Unicode windows. We will always convert W->A->W for messages, so we can
  62. give the system ANSI and the client Unicode. But there are some cases we could optimize this. See GodotDoCallback for another
  63. example where the code is in place do to this properly Ithe fUnicodeSrc param).
  64. (3) There is no support for conversion of parameters for SetWindowsHook/SetWindowsHookEx calls. This would be a major
  65. undertaking, but it is at least as possible as anything else we have done here.
  66. (4) We are not doing any UNLOAD work right now. We basically have:
  67. (A) each API pointer in a section named .data$<dllname><apiname>. The linker would merge them all into .data and would
  68. sort based on the dll/api. We could support unloading them, but this would require us to keep track of what we've done
  69. so we can put the data back (just memcpy them in all at once).
  70. (B) For the NT case, we have up to 10 API handles obtained by LoadLibrary calls that we will not have freed at process
  71. close time. These handles will be in the user's code, not ours. We cannot free them in DLL_PROCESS_DETATCH since PSDK
  72. docs insist this would be bad juju.
  73. (C) For the Win9x case, we have one handle in the user's code (for unicows.dll) and up to six handles for other DLLs in
  74. our code. We cannot free them in DLL_PROCESS_DETATCH, as discussed in (B), above.
  75. All of these items will be freed at process detatch time. But it would be nice to do something better here.
  76. (5) We could support smart card APIs (Win95 OSR 2.1 and later). This would mean the following APIs:
  77. GetOpenCardName
  78. SCardAddReaderToGroup
  79. SCardConnect
  80. SCardForgetCardType
  81. SCardForgetReader
  82. SCardForgetReaderGroup
  83. SCardGetProviderId
  84. SCardIntroduceCardType
  85. SCardIntroduceReader
  86. SCardIntroduceReaderGroup
  87. SCardListCards
  88. SCardListInterfaces
  89. SCardListReaderGroups
  90. SCardListReaders
  91. SCardLocateCards
  92. SCardRemoveReaderFromGroup
  93. SCardSetCardTypeProviderName
  94. SCardStatus
  95. Note that these APIs will not exist on any Win9x platform unless the DLL is specifically installed (it comes from the PSDK).
  96. It might be better to have them recompile with us rather than trying to wrap them, anyway.
  97. ----------------------------------------------
  98. Special thanks to (in alphabetical order):
  99. Gerardo Bermudez (GerardoB) - who has clearly forgotten more about user messaging that most people will ever know!
  100. Barry Bond (BarryBo) - who did the inital proof of concept that we took and ran 400 miles with!
  101. Raymond Chen (RaymondC) - who helped with many random Win9x issues that I ran across during this project.
  102. Chris Jones (ChrisJo) - who said yes to doing this project so I could get paid!
  103. Jay Krell (JayKrell) - who helped navigate through the myriad of issues with DllMain and TLS allocation issues.
  104. Phil Lucido (PhilipLu) - who helped us shed our CRT dependency.
  105. Mike Sheldon (MikeSh) - who helped point to a solid model for our subclass tracking.
  106. Dan Spalding (DanS) - who helped us with our initial delayload work that served us well till we found something better!
  107. Bryan Tuttle (BryanT) - who did most of the work for the loader! Who else could simply write their own delayload???
  108. Michael S. Kaplan (v-michka)
  109. Trigeminal Software, Inc.
  110. http://www.trigeminal.com/
  111. 16 March 2001