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.

760 lines
27 KiB

  1. #ifndef _INC_IFAXOS
  2. #ifndef _INC_RUNTIME
  3. #define _INC_IFAXOS //could be dropped once other include files stop including ifaxos.h
  4. #define _INC_RUNTIME
  5. #ifdef __cplusplus //make sure everything has a "C" interface
  6. extern "C" {
  7. #endif
  8. #ifndef WINDRV
  9. # ifdef WIN32
  10. # define _INC_OLE
  11. # endif
  12. # include <windows.h>
  13. # ifdef WIN32
  14. # include <windowsx.h>
  15. # endif
  16. #endif
  17. /*
  18. * If using 16bit compiler, need to define some types that
  19. * are now defined for the 32bit compiler
  20. */
  21. #if defined (DOS16) | defined (WIN16)
  22. #include <aw16bit.h>
  23. #if defined (DOS16)
  24. #include <string.h>
  25. #define lstrlen(a) _fstrlen(a)
  26. #endif
  27. #endif
  28. /*
  29. * Cross platform File I/O
  30. * DOS16 used by lhutil
  31. */
  32. #if defined (DOS16)
  33. #include <io.h>
  34. #define IOSEEK _lseek
  35. #define IOREAD _read
  36. #define IOWRITE _write
  37. #define HFILE int
  38. #else /* WIN32 | WIN16 */
  39. #define IOSEEK _llseek
  40. #define IOREAD _lread
  41. #define IOWRITE _lwrite
  42. #endif /* DOS16 */
  43. typedef CHAR FAR *LPCHAR;
  44. typedef CHAR NEAR *NPCHAR;
  45. #define CARRAIGE_RETURN 0x0D
  46. #define LINEFEED 0x0A
  47. #define BACKSPACE 0x08
  48. #define CNULL 0x00
  49. #ifndef WIN32
  50. #ifndef MAKEWORD
  51. # define MAKEWORD(low, high) ((WORD)(((BYTE)(low)) | (((WORD)((BYTE)(high))) << 8)))
  52. #endif
  53. # define EXPORT_DLL
  54. # define IMPORT_DLL
  55. #else
  56. # ifndef HTASK
  57. # define HTASK HANDLE
  58. # endif
  59. # define __export __declspec( dllexport )
  60. # define _export __declspec( dllexport )
  61. # define IMPORT_DLL __declspec( dllimport )
  62. # define EXPORT_DLL __declspec( dllexport )
  63. #endif
  64. // --------------- RESOURCE management -------------------------------
  65. // Always define this for now ...
  66. #ifndef SHIP_BUILD
  67. // #if defined(VALIDATE) || defined(DEBUGAPI) || defined(DEBUG)
  68. /********
  69. @doc EXTERNAL RESOURCE IFAXOS
  70. @type VOID | RESOURCE_ALLOC_FLAGS | Lists the resource management options
  71. for OS resource accounting.
  72. @emem RES_ALLOC_TASK | This flag indicates that the resource in question
  73. is being allocated on behalf of the current process. The resource
  74. should not be directly passed on to any other process context. It
  75. should be freed by this process before termination - else the kernel
  76. will free it when the process dies (if running in debug).
  77. Ownership automatically gets transferred between tasks when standard
  78. IPC methods like pipes are used to transfer resources like Buffers.
  79. @emem RES_ALLOC_NONE | This flag is used to allocate resources which should
  80. not be accounted to any system module. The calling party essentially
  81. undertakes full responsibility for freeing this object. This is mainly
  82. to be used for resource allocated on behalf of messages in the store
  83. since their ownership is transferred to the current process which has
  84. the message open.
  85. @emem HINSTANCE_DLL | If the allocated resource is to be assigned to the
  86. calling DLL, the hinstance of the DLL should be passed in as the value
  87. of the ResourceFlags Word. These resources will be freed (in the debug
  88. version) when the DLL terminates. They will not be assigned to any
  89. particular process context.
  90. @xref <f IFBufAlloc> <f IFMemAlloc> <f CreateMutex> <f CreateEvent>
  91. <f IFPipeCreate> <f IFProcSetResFlags>
  92. ********/
  93. #define RES_ALLOC_TASK 0x0000
  94. #define RES_ALLOC_NONE 0x0001
  95. #define RES_ALLOC_INTERNAL 0x0002
  96. #define RES_ALLOC_CRITSEC 0x0003
  97. #if defined(WFW) || defined(WIN32)
  98. #define IFProcSetResFlags(wResFlags) (0)
  99. #else
  100. extern EXPORT_DLL VOID WINAPI IFProcSetResFlags(WORD wResFlags);
  101. #endif
  102. #else
  103. #define IFProcSetResFlags(p1) (0)
  104. #endif
  105. // Functions -----------
  106. #ifndef WIN32
  107. HTASK WINAPI GetWindowTask(HWND hwnd);
  108. #ifndef SHIP_BUILD
  109. DWORD WINAPI IFProcProfile(HTASK hTask, BOOL fStart);
  110. #else
  111. #define IFProcProfile(HTASK,FSTART) (0)
  112. #endif
  113. #else
  114. // Remove calls to Profile ..
  115. #define IFProcProfile(x,y) (DWORD)(0)
  116. #endif
  117. #ifdef DEBUG
  118. /********
  119. @doc EXTERNAL IFAXOS DEBUG MACROS
  120. @api BOOL | RETAILMSG | Prints a message on the debug
  121. console even for retail builds.
  122. @parm <lt>printfexp<gt> | printf_exp | Printf parameters for the
  123. message to be displayed. Must be enclosed in a single pair of
  124. parentheses.
  125. @comm Should be used to display debugging messages which are desired
  126. in the retail build. For obvious reasons this should be used
  127. sparingly. The benefit is that all such messages can be turned off
  128. for the shipping build by simply changing the macro in ifaxos.h
  129. @ex Example Definition & Use |
  130. RETAILMSG (("0x%04X:Scanner Opened !!\r\n", GetCurrentTask()));
  131. This will print a trace message like:
  132. 0x4567:Scanner Opened !!
  133. @xref <f IFDbgPrintf>
  134. ********/
  135. #define RETAILMSG(printf_exp) (IFDbgPrintf printf_exp)
  136. /********
  137. @doc EXTERNAL IFAXOS DEBUG MACROS
  138. @api BOOL | WARNINGMSG | Prints a warning message on the debug
  139. console even for retail builds.
  140. @parm <lt>printfexp<gt> | printf_exp | Printf parameters for the
  141. message to be displayed. Must be enclosed in a single pair of
  142. parentheses.
  143. @comm Should be used to display debugging messages which are desired
  144. in the retail build. For obvious reasons this should be used
  145. sparingly. The benefit is that all such messages can be turned off
  146. for the shipping build by simply changing the macro in ifaxos.h
  147. @ex Example Definition & Use |
  148. WARNINGMSG (("0x%04X:Scanner Opened !!\r\n", GetCurrentTask()));
  149. This will print a trace message like:
  150. WARNING: 0x4567:Scanner Opened !!
  151. @xref <f IFDbgPrintf> <f ERRORMSG>
  152. ********/
  153. #define WARNINGMSG(printf_exp) \
  154. (IFDbgPrintf("WARNING:(0x%08lX):%s:",GetCurrentProcessId(),(LPSTR)(dpCurSettings.lpszName)), \
  155. IFDbgPrintf printf_exp ,\
  156. 1)
  157. /********
  158. @doc EXTERNAL IFAXOS DEBUG MACROS
  159. @api BOOL | DEBUGMSG | Prints a trace message on the debug
  160. console depending on enable flags set by the user.
  161. @parm <lt>c_expression<gt> | cond | Boolean condition which is
  162. evaluated to decide whether or not to print the message.
  163. @parm <lt>printfexp<gt> | printf_exp | Printf parameters for the
  164. message to be displayed. Must be enclosed in a single pair of
  165. parentheses.
  166. @rdesc TRUE if the message is printed, and FALSE if it is not.
  167. @comm The condition should consist of a boolean expression testing whether
  168. the relevant zones are on or off. Each module has a current zone
  169. mask which identifies which of the possible 32 zones is currently on.
  170. The top 16 bits of these are reserved for use for system defined
  171. zones - like ZONE_FUNC_ENTRY which is defined as
  172. #define ZONE_FUNC_ENTRY (0x00010000&dpCurSettings.ulZoneMask)
  173. Modules should take care to see
  174. that they print out trace messages which are meaningful and conform
  175. to some pattern - remember that other people than you have to see
  176. and make sense of your messages. The general format I have been
  177. following is :
  178. <lt>Task ID<gt> :
  179. <lt>ModuleName<gt>:<lt>SubModule<gt>:<lt>Function<gt>:<lt>msg<gt>
  180. The task ID is useful to sort out the output of multiple tasks
  181. running in the system. The example call above yields this kind of
  182. output.
  183. The various predefined system zones are:
  184. ZONE_FUNC_ENTRY : To be used for all function entry and exit
  185. messages. By convention, the parameters should be printed
  186. on entry, and the return value should be printed on exit.
  187. Any values printed in hexadecimal should be preceded by a 0x
  188. ZONE_INT_FUNC : To be used for any other traces at interesting
  189. points within a function.
  190. All trace messages are disabled in a non debug build.
  191. @ex Example Definition & Use |
  192. #define ZONE_CUSTOM (0x00000001&dpCurSettings.ulZoneMask)
  193. DEBUGMSG (ZONE_FUNC_ENTRY && ZONE_CUSTOM,
  194. ("0x%04X:IFK:Buffers:GenericFunction:Entry\r\n",
  195. GetCurrentTask()));
  196. This will print a trace message only if the user has turned the
  197. function entry zone and the custom zone on.
  198. @xref <f IFDbgPrintf>
  199. ********/
  200. #define BG_CHK(exp) \
  201. ((exp)?1:( \
  202. IFDbgPrintf ("DEBUGCHK failed in file %s at line %d \r\n", \
  203. (LPSTR) __FILE__ , __LINE__ ), 1 \
  204. ))
  205. #ifndef DEBUGCHK_UNSAFE_IN_WFWBG
  206. #define DBGCHK(module,exp) \
  207. ((exp)?1:( \
  208. IFDbgPrintf ("%s: DEBUGCHK failed in file %s at line %d \r\n", \
  209. (LPSTR) module, (LPSTR) __FILE__ , __LINE__ ), \
  210. IFDbgCheck() \
  211. ))
  212. #define DEBUGCHK(exp) DBGCHK(dpCurSettings.lpszName, exp)
  213. #endif
  214. #if 0
  215. #define DEBUGMSG(cond,printf_exp) \
  216. ((cond)?(IFDbgPrintf printf_exp),1:0)
  217. #endif
  218. #define DEBUGMSG(cond,printf_exp) \
  219. (IFDbgPrintf printf_exp)
  220. /********
  221. @doc EXTERNAL IFAXOS DEBUG MACROS
  222. @api BOOL | ERRORMSG | Prints an error message on the debug
  223. console.
  224. @parm <lt>printfexp<gt> | printf_exp | Printf parameters for the
  225. message to be displayed. Must be enclosed in a single pair of
  226. parentheses.
  227. @comm Should be used to display Error messages.
  228. @ex Example Definition & Use |
  229. ERRORMSG (("0x%04X:JOB Failed !!\r\n", GetCurrentTask()));
  230. This will print a trace message like:
  231. ERROR: Job Process: 0x2346: JOB Failed !!
  232. @xref <f IFDbgPrintf>
  233. ********/
  234. #define ERRORMSG(printf_exp) \
  235. (IFDbgPrintf("ERROR:(0x%08lX):%s:",GetCurrentProcessId(),(LPSTR)(dpCurSettings.lpszName)), \
  236. IFDbgPrintf printf_exp ,\
  237. 1)
  238. // Standard Debug zones
  239. #define ZONE_FUNC_ENTRY (0x00010000&dpCurSettings.ulZoneMask)
  240. #define ZONE_INT_FUNC (0x00020000&dpCurSettings.ulZoneMask)
  241. /********
  242. @doc EXTERNAL IFAXOS DEBUG MACROS
  243. @api BOOL | DEBUGSTMT | Evaluates the expression in debug mode.
  244. @parm <lt>c_exp<gt> | exp | Expression to be evaluated.
  245. @rdesc Returns the value returned by the expression.
  246. @comm This macro is provided for convenience and code readability purposes
  247. to replace a construct of the form
  248. #ifdef DEBUG
  249. exp;
  250. #endif
  251. It evaluates to zero in a non debug build.
  252. ********/
  253. #define DEBUGSTMT(exp) exp
  254. #else //Not Debug
  255. // These are to macro out all debug stuff in retail/ship builds
  256. #define RETAILMSG(printf_exp) (0)
  257. #define ERRORMSG(printf_exp) (0)
  258. #define WARNINGMSG(printf_exp) (0)
  259. #define DEBUGMSG(cond,expr) (0)
  260. #define DBGCHK(module,exp) (0)
  261. #define DEBUGCHK(exp) (0)
  262. #define BG_CHK(exp) (0)
  263. #define DEBUGSTMT(exp) (0)
  264. #endif
  265. //----------------------------- MESSAGING -------------------------
  266. // Message type definitions - below 0x0400 is reserved by windows,
  267. // between 0x0400 and 0x0800 is reserved by the IFAX OS
  268. #define IF_START WM_USER+0x0300
  269. #define IF_USER IF_START+0x0400
  270. #include <errormod.h>
  271. /********
  272. @doc EXTERNAL DEFINES ERROR IFAXOS
  273. @type VOID | SYSTEM_MODULES | Identifiers for all the standard system modules.
  274. @emem MODID_NONE | Use this if you are not setting the module ID. DONT USE ZERO !!
  275. @emem MODID_WIN32 | Set for modules returning standard Win32 system error codes
  276. @emem MODID_BOSS | ID = 1 Error in BOSS
  277. @emem MODID_WINMODULE | ID = 2 All windows modules including UER/GDI/KERNEL
  278. @emem MODID_IFKERNEL | ID = 3
  279. @emem MODID_IFFILESYS | ID = 4
  280. @emem MODID_MSGSTORE | ID = 5
  281. @emem MODID_LINEARIZER | ID = 6
  282. @emem MODID_SECURITY | ID = 7
  283. @emem MODID_IFPRINT | ID = 8 High level Printer Driver
  284. @emem MODID_IFSCAN | ID = 9 High level Scanner Driver
  285. @emem MODID_IFSIPX | ID = 10 SPX/IPX Stack
  286. @emem MODID_REND_SERVER | ID = 11 Rendering Server
  287. @emem MODID_FORMAT_RES | ID = 12 Format Resolution
  288. @emem MODID_IFFILE | ID = 13 IFFiles
  289. @emem MODID_TEXTRENDERER | ID = 14 Ascii Renderer
  290. @emem MODID_DIGCOVPAGE | ID = 15 Digital Coverpage
  291. @emem MODID_AWBRANDER | ID = 16 Fax Brander
  292. @emem MODID_MSGSVR | ID = 17 Message Server
  293. @emem MODID_MSGHNDLR | ID = 18 Per-Connection message handler
  294. @emem MODID_MODEMDRV | ID = 19 Modem driver
  295. @emem MODID_PSIFAX | ID = 20 PSI Fax protocol
  296. @emem MODID_AWT30 | ID = 21
  297. @emem MODID_PSIFAXBG | ID = 22
  298. @emem MODID_AWNSF | ID = 23
  299. @emem MODID_FAXCODEC | ID = 24
  300. @emem MODID_MSGPUMP | ID = 25
  301. @emem MODID_AWREPORT | ID = 26
  302. @emem MODID_MSGSVRD | ID = 27
  303. @emem MODID_CUSTOM | ID = 160 Beyond this are custom/installable modules
  304. @xref <f IFErrAssemble> <f IFErrGetModule>
  305. ********/
  306. // System Module IDs
  307. #define MODID_WIN32 0
  308. #define MODID_BOSS 1
  309. #define MODID_WINMODULE 2
  310. #define MODID_IFKERNEL 3
  311. #define MODID_IFFILESYS 4
  312. #define MODID_MSGSTORE 5
  313. #define MODID_LINEARIZER 6
  314. #define MODID_SECURITY 7
  315. #define MODID_IFPRINT 8
  316. #define MODID_IFSCAN 9
  317. #define MODID_IFSIPX 10
  318. #define MODID_REND_SERVER 11
  319. #define MODID_FORMAT_RES 12
  320. #define MODID_IFFILE 13
  321. #define MODID_TEXTRENDERER 14
  322. #define MODID_DIGCOVPAGE 15
  323. #define MODID_AWBRANDER 16
  324. #define MODID_MSGSVR 17
  325. #define MODID_MSGHNDLR 18
  326. #define MODID_MODEMDRV 19
  327. #define MODID_PSIFAX 20
  328. #define MODID_AWT30 21
  329. #define MODID_PSIFAXBG 22
  330. #define MODID_AWNSF 23
  331. #define MODID_FAXCODEC 24
  332. #define MODID_MSGPUMP 25
  333. #define MODID_AWREPORT 26
  334. #define MODID_MSGSVRD 27
  335. #define MAXMODID 26
  336. #define MODID_NONE 159
  337. // Special module ID's
  338. #define MODID_CUSTOM 160
  339. /********
  340. @doc EXTERNAL ERROR IFAXOS
  341. @api DWORD | IFErrAssemble | Forms an IFAX Error dword out of its components.
  342. @parm BYTE | bProcessID | Identifies the process in whose context the error
  343. occured. Must be one of the predefined system process ID's - see <t SYSTEM_PROCESSES>
  344. for the list. This field does not need to be filled in until an error is
  345. propagated across a process boundary. If not being set to a valid PROCID, this
  346. should be initilialized to one of the following values:
  347. @flag PROCID_WIN32 | if <p bModuleID> is set to MODID_WIN32.
  348. @flag PROCID_NONE | for all other cases.
  349. @parm BYTE | bModuleID | Identifies the module reporting the error. MUST be
  350. one of the predefined system module ID's - see <t SYSTEM_MODULES> for the
  351. list.
  352. @parm WORD | wApiCode | Identifies the API code for the error in the module indicated
  353. by <p bModuleID>. All Api codes should be defined in the file errormod.h. Api codes should
  354. be defined so that the low 6 bits are zero. This allows both the <p wApiCode> and the
  355. <p wErrorCode> to be logical OR'ed together and stored as a single word.
  356. @parm WORD | wErrorCode | Identifies the error code. The format
  357. of this is module dependent. For uniformity however, it is highly
  358. encouraged that all IFAX modules use a standard format for this error word.
  359. This standard format reserves the first 6 bits for an error code,
  360. and the high 10 bits for an API identifier.
  361. If the IFAX format is being used, the <p wApiCode>
  362. parameter should be used to pass in the high 10 bits, and the <p wErrorCode> (This
  363. parameter!) should be used to pass in the 6 bit error code. Values upto ERR_FUNCTION_START
  364. are reserved for standard system errors - see <t SYSTEM_ERROR_VALUES> for the list.
  365. Error values should be positive and less than 64.
  366. Other modules like the filesystem conform completely to the Win32 Error space. These
  367. should set <p wErrorCode> to standard Win32 errors (use all 16 bits) and leave
  368. the <p wApiCode> as API_WIN32.
  369. Still others need to use all 16 bits in a custom manner - like the Printer Drivers.
  370. These *must* set the <p bModuleID> correctly so that the error can be interpreted
  371. appropriately. Standard processes like the UI have to understand these error codes,
  372. so only inbuilt system modules which they have knowledge about can use custom codes.
  373. These should set the wApiCode to API_NONE.
  374. @rdesc Returns the DWORD representation for this error. This allows this to be directly
  375. passed in as input to <f SetLastError>.
  376. @ex Example usage |
  377. SetLastError(IFErrAssemble(PROCID_NONE,MODID_IFKERNEL,API_IFK_POSTMESSAGE,ERR_INVALID_PARAM));
  378. @xref <f IFErrGetModule> <f IFErrGetProcess> <f GetIFErrorErrcode> <f SetLastError>
  379. <f GetIFErrorApicode> <t SYSTEM_MODULES> <t SYSTEM_PROCESSES> <t SYSTEM_ERROR_VALUES>
  380. <f GetLastError> <f IFNVRamSetError> <f GetIFErrorCustomErrcode>
  381. ********/
  382. #define IFErrAssemble(process,module,call,error) \
  383. MAKELONG((WORD)call|(WORD)error, MAKEWORD((BYTE)module, (BYTE)process))
  384. #define GetIFErrorErrcode(errvar) (LOWORD((DWORD)errvar) & 0x003F)
  385. #define GetIFErrorCustomErrcode(errvar) LOWORD((DWORD)errvar)
  386. /********
  387. @doc EXTERNAL DEFINES ERROR IFAXOS
  388. @type VOID | SYSTEM_PROCESSES | Identifiers for all the standard system processes.
  389. @emem PROCID_WIN32 | Used to initialize for Win32 modules.
  390. @emem PROCID_NONE | Used when process context does not need to be set.
  391. @emem PROCID_MSGSCHED | ID = 0x21
  392. @emem PROCID_JOBPROCESS | ID = 0x22
  393. @emem PROCID_UI | ID = 0x23
  394. @emem PROCID_PRINTER | ID = 0x24
  395. @emem PROCID_SCANNER | ID = 0x25
  396. @emem PROCID_MSGSVR | ID = 0x26
  397. @emem PROCID_GRRENDER | ID = 0x27
  398. @emem PROCID_MSGHNDLR | ID = 0x28
  399. @emem PROCID_PARADEV | ID = 0x29
  400. @emem PROCID_UIBGPROC | ID = 0x30
  401. @comm All Process ID's need to have the 6th bit set to be compatible with the
  402. standard Win32 error definitions.
  403. @xref <f IFErrAssemble> <f IFErrGetProcess>
  404. ********/
  405. // System Process IDs
  406. #define PROCID_WIN32 0x00
  407. #define PROCID_NONE 0x20
  408. #define PROCID_MSGSCHED 0x21
  409. #define PROCID_JOBPROCESS 0x22
  410. #define PROCID_UI 0x23
  411. #define PROCID_PRINTER 0x24
  412. #define PROCID_SCANNER 0x25
  413. #define PROCID_MSGSVR 0x26
  414. #define PROCID_GRRENDER 0x27
  415. #define PROCID_MSGHNDLR 0x28
  416. #define PROCID_PARADEV 0x29
  417. #define PROCID_UIBGPROC 0x30
  418. // Strings used in debug version for friendly display
  419. #define MAXPROCID 11
  420. #define SYSPROCESSSTRINGS \
  421. {"None", "Msg Scheduler", "Job Process", "UI Process", "Printer", "Scanner", \
  422. "Msg Transport", "GR Renderer", "Msg Handler", "Para Dev", "UIBGProc" }
  423. /********
  424. @doc EXTERNAL DEFINES ERROR IFAXOS
  425. @type VOID | SYSTEM_ERROR_VALUES | This defines all the standard
  426. system error values.
  427. @emem ERR_NOT_ENOUGH_MEM | Value = 0x0001 : Indicates an out of memory
  428. condition.
  429. @emem ERR_INVALID_PARAM | Value = 0x0002 : Indicates that any one of
  430. the parameters passed to the function was invalid.
  431. @emem ERR_FUNCTION_START | Value = 0x0010 : Any error value above this
  432. had been custom defined by the called function. If you need
  433. a custom error value, you can define it starting from this
  434. value.
  435. @xref <f IFErrAssemble>
  436. ********/
  437. // System Error values
  438. #define ERR_NOT_ENOUGH_MEM 0x0001
  439. #define ERR_INVALID_PARAM 0x0002
  440. #define ERR_FUNCTION_START 0x0010
  441. // Strings used in debug version for friendly display
  442. #define SYSERRORSTRINGS \
  443. {"None", "Out Of Memory", "Invalid Param", "Unused", "Unused", "Unused", \
  444. "Unused", "Unused", "Unused", "Unused", "Unused", "Unused", \
  445. "Unused", "Unused", "Unused", "Unused" }
  446. #include <buffers.h>
  447. // --------------- Global Pool Management ----------------------------------
  448. /********
  449. @doc EXTERNAL IFAXOS DEFINES GLOBMEM
  450. @type VOID | STANDARD_BLOCK_SIZES | This defines all the standard global
  451. memory block sizes. As far as possible all memory allocations
  452. should be for one of these sizes. Any other size will be much
  453. more inefficient and couls cause fragmentation of system
  454. memory.
  455. @emem ONLY_HEADER_SIZE| This will allocate a buffer with no data
  456. associated with it. This can be used to pass metadata between
  457. processes - eg an END_OF_JOB buffer marker.
  458. @emem SMALL_HEADER_SIZE| This currently defines a 32 byte memory
  459. block. It is used for all buffer headers, and can be used
  460. for things like protocol headers, structure headers etc.
  461. @emem COMPRESS_DATA_SIZE | This defines a 1Kb memory block which
  462. should be used to store any compressed data form. This is
  463. the general purpose data storage size. Any buffer which
  464. could be around for a long time should contain compressed
  465. data in this size of buffer.
  466. @emem RAW_DATA_SIZE | This defines a large buffer size (currently
  467. 8Kb) for use by renderers as frame buffers. They should be
  468. used only to store raw bitmap data which is being sent
  469. directly to a consumer device like the printer. There are
  470. very few of these - so they should be used only for this
  471. short lived purpose.
  472. @emem BAND_BUFFER_SIZE| This defines a jumbo buffer of 64K for use
  473. by the resource-based renderer. There may be only one such
  474. buffer in the global pool. (NOT IMPLEMENTED YET)
  475. @xref <f IFMemAlloc> <f IFBufAlloc>
  476. ********/
  477. // Std block sizes
  478. #define ONLY_HEADER_SIZE 0 // No data
  479. #define SMALL_HEADER_SIZE -1 // 32b
  480. #define COMPRESS_DATA_SIZE -2 // 1Kb
  481. // --------------- Global Pool Management ----------------------------------
  482. /********
  483. @doc EXTERNAL IFAXOS DEFINES GLOBMEM
  484. @type VOID | STANDARD_BLOCK_SIZES | This defines all the standard global
  485. memory block sizes. As far as possible all memory allocations
  486. should be for one of these sizes. Any other size will be much
  487. more inefficient and couls cause fragmentation of system
  488. memory.
  489. @emem ONLY_HEADER_SIZE| This will allocate a buffer with no data
  490. associated with it. This can be used to pass metadata between
  491. processes - eg an END_OF_JOB buffer marker.
  492. @emem SMALL_HEADER_SIZE| This currently defines a 32 byte memory
  493. block. It is used for all buffer headers, and can be used
  494. for things like protocol headers, structure headers etc.
  495. @emem COMPRESS_DATA_SIZE | This defines a 1Kb memory block which
  496. should be used to store any compressed data form. This is
  497. the general purpose data storage size. Any buffer which
  498. could be around for a long time should contain compressed
  499. data in this size of buffer.
  500. @emem RAW_DATA_SIZE | This defines a large buffer size (currently
  501. 8Kb) for use by renderers as frame buffers. They should be
  502. used only to store raw bitmap data which is being sent
  503. directly to a consumer device like the printer. There are
  504. very few of these - so they should be used only for this
  505. short lived purpose.
  506. @emem BAND_BUFFER_SIZE| This defines a jumbo buffer of 64K for use
  507. by the resource-based renderer. There may be only one such
  508. buffer in the global pool. (NOT IMPLEMENTED YET)
  509. @xref <f IFMemAlloc> <f IFBufAlloc>
  510. ********/
  511. // Std block sizes
  512. #define ONLY_HEADER_SIZE 0 // No data
  513. #define SMALL_HEADER_SIZE -1 // 32b
  514. #define COMPRESS_DATA_SIZE -2 // 1Kb
  515. //
  516. #define RAW_DATA_SIZE -3 // 8Kb
  517. // Special size for modem ECM frame
  518. #define BYTE_265_SIZE -4 // 265 bytes
  519. #define BYTE_265_ACTUALSIZE 265
  520. // Number of sizes
  521. #define MAX_POOL_INDEX -4 // For parameter validation
  522. // Not available yet!
  523. #define BAND_BUFFER_SIZE 30720 // 64Kb
  524. // Flag to force global alloc. Uses a windows flag which is ignored/defunct in
  525. // the 3.1 kernel (and the boss kernel)
  526. #define IFMEM_USEGLOBALALLOC GMEM_NOT_BANKED
  527. typedef struct _DBGPARAM {
  528. CHAR lpszName[32]; // name of module
  529. HWND hwnd; // Primary window Handle if task, NULL otherwise
  530. CHAR rglpszZones[16][32]; // names of zones for first 16 bits
  531. ULONG ulZoneMask; // Zone Mask
  532. } DBGPARAM, FAR *LPDBGPARAM;
  533. // Functions
  534. extern LPBUFFER IFBufAlloc (LONG lBufSize);
  535. extern BOOL IFBufFree (LPBUFFER lpbf);
  536. extern EXPORT_DLL LPBUFFER WINAPI IFBufSplit (LPBUFFER lpbf, LPBYTE lpb);
  537. extern VOID FAR IFDbgPrintf(LPSTR lpszFmt, ...);
  538. extern EXPORT_DLL BOOL WINAPI IFDbgCheck(VOID);
  539. extern LPVOID IFMemAlloc (UINT fuAlloc, LONG lAllocSize,
  540. LPWORD lpwActualSize);
  541. extern BOOL IFMemFree (LPVOID lpvMem);
  542. /***********************************************************************
  543. *
  544. * Standard Memory Allocation Routines
  545. * for easy crossplatform development
  546. * with resource tracking code.
  547. * Routines are in MEMORY.C
  548. *
  549. ***********************************************************************/
  550. #ifndef NOSTD_MEM_RTNS
  551. PVOID WINAPI AWMemAlloc(UINT cb);
  552. PVOID WINAPI AWMemReAlloc(PVOID pv, UINT cb);
  553. PVOID WINAPI AWMemFree(PVOID pv);
  554. #endif /* NOSTD_MEM_RTNS */
  555. /***********************************************************************
  556. *
  557. * Registry functions prototypes
  558. *
  559. ***********************************************************************/
  560. // registry functions prototypes
  561. UINT AwGetInitializerInt(HKEY hPDKey, LPCTSTR lpszSection, LPCTSTR lpszKey, INT dwDefault,
  562. LPCTSTR lpszFile);
  563. DWORD AwGetInitializerString(HKEY hPDKey, LPCTSTR lpszSection, LPCTSTR lpszKey,
  564. LPCTSTR lpszDefault, LPTSTR lpszReturnBuffer, DWORD cchReturnBuffer,
  565. LPCTSTR lpszFile);
  566. BOOL AwWriteInitializerString(HKEY hPDKey, LPCTSTR lpszSection, LPCTSTR lpszKey,
  567. LPCTSTR lpszString, LPCTSTR lpszFile);
  568. BOOL AwWriteInitializerInt(HKEY hPDKey, LPCTSTR lpszSection, LPCTSTR lpszKey,
  569. DWORD i, LPCTSTR lpszFile);
  570. // Encourage people to use the correct variable
  571. extern DBGPARAM dpCurSettings;
  572. #ifdef __cplusplus
  573. } // extern "C" {
  574. #endif
  575. #endif
  576. #endif