Mobile API Reference  MicroStrategy 2019
PDCwinbase.h
Go to the documentation of this file.
1 //==============================================================================================
2 // FILENAME : PDCwinbase.h
3 // AUTHOR : Perl Script
4 // CREATION : 6/13/02
5 // Copyright (C) MicroStrategy, Inc. 2002
6 //==============================================================================================
7 #ifndef PDCwinbase_h
8 #define PDCwinbase_h
9 
10 // this must be the *first* file included
11 #include "ProtectedSource/Prolog.h"
12 
13 #if defined(WIN32) && !defined(_USE_MSI_COM)
14 // #ifndef _WIN32_WINNT
15 // #define _WIN32_WINNT 0x0500 // for Windows 2000+ APIs
16 // #endif
17 
18  #include <winbase.h>
19  #include "ProtectedSource/UndefineWin32APIAliases.h"
20 #else
21  /************************************************************************
22  * *
23  * winbase.h -- This module defines the 32-Bit Windows Base APIs *
24  * *
25  * Copyright 1990 - 1998 Microsoft Corp. All rights reserved. *
26  * *
27  ************************************************************************/
28  #ifndef _WINBASE_
29  #define _WINBASE_
30 
31 #ifdef WIN32
32  #include "../../../../3rdParty/BaseTsd.h"
33 #endif
34 
35  #define FORMAT_MESSAGE_ALLOCATE_BUFFER 0x00000100
36  #define FORMAT_MESSAGE_IGNORE_INSERTS 0x00000200
37  #define FORMAT_MESSAGE_FROM_STRING 0x00000400
38  #define FORMAT_MESSAGE_FROM_HMODULE 0x00000800
39  #define FORMAT_MESSAGE_FROM_SYSTEM 0x00001000
40  #define FORMAT_MESSAGE_ARGUMENT_ARRAY 0x00002000
41  #define FORMAT_MESSAGE_MAX_WIDTH_MASK 0x000000FF
42 
43  #define WAIT_TIMEOUT STATUS_TIMEOUT
44  #define WAIT_IO_COMPLETION STATUS_USER_APC
45  #define STILL_ACTIVE STATUS_PENDING
46  #define EXCEPTION_ACCESS_VIOLATION STATUS_ACCESS_VIOLATION
47  #define EXCEPTION_DATATYPE_MISALIGNMENT STATUS_DATATYPE_MISALIGNMENT
48  #define EXCEPTION_BREAKPOINT STATUS_BREAKPOINT
49  #define EXCEPTION_SINGLE_STEP STATUS_SINGLE_STEP
50  #define EXCEPTION_ARRAY_BOUNDS_EXCEEDED STATUS_ARRAY_BOUNDS_EXCEEDED
51  #define EXCEPTION_FLT_DENORMAL_OPERAND STATUS_FLOAT_DENORMAL_OPERAND
52  #define EXCEPTION_FLT_DIVIDE_BY_ZERO STATUS_FLOAT_DIVIDE_BY_ZERO
53  #define EXCEPTION_FLT_INEXACT_RESULT STATUS_FLOAT_INEXACT_RESULT
54  #define EXCEPTION_FLT_INVALID_OPERATION STATUS_FLOAT_INVALID_OPERATION
55  #define EXCEPTION_FLT_OVERFLOW STATUS_FLOAT_OVERFLOW
56  #define EXCEPTION_FLT_STACK_CHECK STATUS_FLOAT_STACK_CHECK
57  #define EXCEPTION_FLT_UNDERFLOW STATUS_FLOAT_UNDERFLOW
58  #define EXCEPTION_INT_DIVIDE_BY_ZERO STATUS_INTEGER_DIVIDE_BY_ZERO
59  #define EXCEPTION_INT_OVERFLOW STATUS_INTEGER_OVERFLOW
60  #define EXCEPTION_PRIV_INSTRUCTION STATUS_PRIVILEGED_INSTRUCTION
61  #define EXCEPTION_IN_PAGE_ERROR STATUS_IN_PAGE_ERROR
62  #define EXCEPTION_ILLEGAL_INSTRUCTION STATUS_ILLEGAL_INSTRUCTION
63  #define EXCEPTION_NONCONTINUABLE_EXCEPTION STATUS_NONCONTINUABLE_EXCEPTION
64  #define EXCEPTION_STACK_OVERFLOW STATUS_STACK_OVERFLOW
65  #define EXCEPTION_INVALID_DISPOSITION STATUS_INVALID_DISPOSITION
66  #define EXCEPTION_GUARD_PAGE STATUS_GUARD_PAGE_VIOLATION
67  #define EXCEPTION_INVALID_HANDLE STATUS_INVALID_HANDLE
68  #define CONTROL_C_EXIT STATUS_CONTROL_C_EXIT
69 
70  #define FILE_MAP_COPY SECTION_QUERY
71  #define FILE_MAP_WRITE SECTION_MAP_WRITE
72  #define FILE_MAP_READ SECTION_MAP_READ
73  #define FILE_MAP_ALL_ACCESS SECTION_ALL_ACCESS
74  #define FILE_MAP_EXECUTE SECTION_MAP_EXECUTE_EXPLICIT // not included in FILE_MAP_ALL_ACCESS
75 
76  #ifndef MAX_PATH
77  #define MAX_PATH 260
78  #endif
79 
80  #define IGNORE 0 // Ignore signal
81  #define INFINITE 0xFFFFFFFF // Infinite timeout
82 
83 
84  #ifdef WIN32
85  //kxiao add
86  #define FILE_FLAG_WRITE_THROUGH 0x80000000
87  #define FILE_FLAG_OVERLAPPED 0x40000000
88  #define FILE_FLAG_NO_BUFFERING 0x20000000
89  #define FILE_FLAG_RANDOM_ACCESS 0x10000000
90  #define FILE_FLAG_SEQUENTIAL_SCAN 0x08000000
91  #define FILE_FLAG_DELETE_ON_CLOSE 0x04000000
92  #define FILE_FLAG_BACKUP_SEMANTICS 0x02000000
93  #define FILE_FLAG_POSIX_SEMANTICS 0x01000000
94  #define FILE_FLAG_OPEN_REPARSE_POINT 0x00200000
95  #define FILE_FLAG_OPEN_NO_RECALL 0x00100000
96  #define FILE_FLAG_FIRST_PIPE_INSTANCE 0x00080000
97 
98  //1/19/06 nprabhudessai
99  #define CREATE_NEW 1
100  #define CREATE_ALWAYS 2
101  #define OPEN_EXISTING 3
102  #define OPEN_ALWAYS 4
103  #define TRUNCATE_EXISTING 5
104 
105  typedef struct _WIN32_FIND_DATAA {
106  DWORD dwFileAttributes;
107  FILETIME ftCreationTime;
108  FILETIME ftLastAccessTime;
109  FILETIME ftLastWriteTime;
110  DWORD nFileSizeHigh;
111  DWORD nFileSizeLow;
112  DWORD dwReserved0;
113  DWORD dwReserved1;
114  CHAR cFileName[ MAX_PATH ];
115  CHAR cAlternateFileName[ 14 ];
116  #ifdef _MAC
117  DWORD dwFileType;
118  DWORD dwCreatorType;
119  WORD wFinderFlags;
120  #endif
121  } WIN32_FIND_DATAA, *PWIN32_FIND_DATAA, *LPWIN32_FIND_DATAA;
122 
123  typedef struct _WIN32_FIND_DATAW {
124  DWORD dwFileAttributes;
125  FILETIME ftCreationTime;
126  FILETIME ftLastAccessTime;
127  FILETIME ftLastWriteTime;
128  DWORD nFileSizeHigh;
129  DWORD nFileSizeLow;
130  DWORD dwReserved0;
131  DWORD dwReserved1;
132  WCHAR cFileName[ MAX_PATH ];
133  WCHAR cAlternateFileName[ 14 ];
134  } WIN32_FIND_DATAW, *PWIN32_FIND_DATAW, *LPWIN32_FIND_DATAW;
135 
136  typedef LPWIN32_FIND_DATAW LPWIN32_FIND_DATA;
137  typedef WIN32_FIND_DATAW WIN32_FIND_DATA;
138 
139  typedef struct _MEMORYSTATUSEX {
140  DWORD dwLength;
141  DWORD dwMemoryLoad;
142  DWORDLONG ullTotalPhys;
143  DWORDLONG ullAvailPhys;
144  DWORDLONG ullTotalPageFile;
145  DWORDLONG ullAvailPageFile;
146  DWORDLONG ullTotalVirtual;
147  DWORDLONG ullAvailVirtual;
148  DWORDLONG ullAvailExtendedVirtual;
149  } MEMORYSTATUSEX, *LPMEMORYSTATUSEX;
150  #define STD_INPUT_HANDLE (DWORD)-10
151  #define STD_OUTPUT_HANDLE (DWORD)-11
152  #define STD_ERROR_HANDLE (DWORD)-12
153 
154  #define OPEN_EXISTING 3
155 
156 #ifdef WIN64
157  #define INVALID_HANDLE_VALUE ((HANDLE)(LONG_PTR)-1)
158 #else
159  #define INVALID_HANDLE_VALUE (HANDLE)-1
160 #endif
161 
162  #ifndef WINAPI
163  #define WINAPI __stdcall
164  #endif
165 
166  // declare prototypes of this kernel32.dll functions for Windows only
167  extern "C" UINT WINAPI GetWindowsDirectoryW(
168  LPTSTR lpBuffer, // buffer for Windows directory
169  UINT uSize // size of directory buffer
170  );
171 
172  // declare prototypes of this kernel32.dll functions for Windows only
173  extern "C" UINT WINAPI GetSystemWindowsDirectoryW(
174  LPTSTR lpBuffer, // buffer for Windows directory
175  UINT uSize // size of directory buffer
176  );
177 
178  // declare prototypes of this kernel32.dll functions for Windows only
179  extern "C" DWORD WINAPI GetModuleFileNameW(
180  HMODULE hModule,
181  LPTSTR lpFilename,
182  DWORD nSize
183  );
184 
185  // declare prototypes of this kernel32.dll functions for Windows only
186  extern "C" DWORD WINAPI GetLastError(void);
187 
188  extern "C" BOOL WINAPI IsBadWritePtr(
189  VOID* lp, // memory address
190  UINT ucb // size of memory block
191  );
192 
193  extern "C" BOOL WINAPI IsBadReadPtr(
194  CONST VOID* lp, // memory address
195  UINT ucb // size of memory block
196  );
197 
198  extern "C" HANDLE WINAPI RegisterEventSourceW(
199  LPCTSTR lpUNCServerName, // server name
200  LPCTSTR lpSourceName // source name
201  );
202 
203  extern "C" BOOL WINAPI ReportEventW(
204  HANDLE hEventLog, // handle to event log
205  WORD wType, // event type
206  WORD wCategory, // event category
207  DWORD dwEventID, // event identifier
208  PSID lpUserSid, // user security identifier
209  WORD wNumStrings, // number of strings to merge
210  DWORD dwDataSize, // size of binary data
211  LPCTSTR *lpStrings, // array of strings to merge
212  LPVOID lpRawData // binary data buffer
213  );
214 
215  extern "C" BOOL WINAPI DeregisterEventSource(
216  HANDLE hEventLog // handle to event log
217  );
218 
219 
220  #define InterlockedExchange _InterlockedExchange
221  extern "C" LONG WINAPI _InterlockedExchange(
222  LONG volatile * Target, // value to exchange
223  LONG Value // new value
224  );
225 
226  extern "C" VOID WINAPI Sleep(
227  DWORD dwMilliseconds // sleep time
228  );
229 
230  extern "C" BOOL WINAPI SetStdHandle(
231  DWORD nStdHandle, // input, output, or error device
232  HANDLE hHandle // handle
233  );
234 
235  extern "C" HANDLE WINAPI CreateFileW(
236  LPCTSTR lpFileName, // file name
237  DWORD dwDesiredAccess, // access mode
238  DWORD dwShareMode, // share mode
239  LPSECURITY_ATTRIBUTES lpSecurityAttributes, // SD
240  DWORD dwCreationDisposition, // how to create
241  DWORD dwFlagsAndAttributes, // file attributes
242  HANDLE hTemplateFile // handle to template file
243  );
244 
245  //kxiao add for security subsytem on MSICOM Windows
246  extern "C" HANDLE
247  WINAPI
248  GetCurrentProcess(
249  VOID
250  );
251 
252  extern "C"
253  HANDLE
254  WINAPI
255  GetCurrentThread(
256  VOID
257  );
258 
259  extern "C"
260  BOOL
261  WINAPI
262  OpenProcessToken (
263  HANDLE ProcessHandle,
264  DWORD DesiredAccess,
265  PHANDLE TokenHandle
266  );
267 
268  extern "C"
269  HANDLE
270  WINAPI
271  OpenProcess(
272  DWORD dwDesiredAccess,
273  BOOL bInheritHandle,
274  DWORD dwProcessId
275  );
276 
277  extern "C"
278  DWORD
279  WINAPI
280  GetLengthSid (
281  PSID pSid
282  );
283 
284  extern "C"
285  BOOL
286  WINAPI
287  OpenThreadToken (
288  HANDLE ThreadHandle,
289  DWORD DesiredAccess,
290  BOOL OpenAsSelf,
291  PHANDLE TokenHandle
292  );
293 
294 
295  extern "C"
296  BOOL
297  WINAPI
298  GetTokenInformation (
299  HANDLE TokenHandle,
300  TOKEN_INFORMATION_CLASS TokenInformationClass,
301  LPVOID TokenInformation,
302  DWORD TokenInformationLength,
303  PDWORD ReturnLength
304  );
305 
306  extern "C"
307  BOOL
308  WINAPI
309  GetProcessAffinityMask(
310  __in HANDLE hProcess,
311  __out PDWORD_PTR lpProcessAffinityMask,
312  __out PDWORD_PTR lpSystemAffinityMask
313  );
314 
315  extern "C"
316  BOOL
317  WINAPI
318  SetProcessAffinityMask(
319  __in HANDLE hProcess,
320  __in DWORD_PTR dwProcessAffinityMask
321  );
322 
323 
324  extern "C"
325  BOOL
326  WINAPI
327  QueryPerformanceFrequency(
328  __out LARGE_INTEGER *lpFrequency
329  );
330 
331  extern "C"
332  BOOL
333  WINAPI
334  QueryPerformanceCounter(
335  __out LARGE_INTEGER *lpPerformanceCount
336  );
337 
338  //01/17/06 Added following definitions for MSICOM build nprabhudessai
339  extern "C"
340  BOOL
341  WINAPI
342  GetVersionExA(
343  __inout LPOSVERSIONINFOA lpVersionInformation
344  );
345 
346 
347  extern "C"
348  BOOL
349  WINAPI
350  GetVersionExW(
351  __inout LPOSVERSIONINFOW lpVersionInformation
352  );
353  #ifdef UNICODE
354  #define GetVersionEx GetVersionExW
355  #else
356  #define GetVersionEx GetVersionExA
357  #endif // !UNICODE
358 
359 #ifndef FARPROC
360 typedef int (FAR WINAPI *FARPROC)();
361 #endif
362 
363  extern "C"
364  FARPROC
365  WINAPI
366  GetProcAddress (
367  __in HMODULE hModule,
368  __in LPCSTR lpProcName
369  );
370 
371  extern "C"
372  VOID
373  WINAPI
374  GlobalMemoryStatus(
375  __out LPMEMORYSTATUS lpBuffer
376  );
377 
378  extern "C"
379  __out
380  HMODULE
381  WINAPI
382  GetModuleHandleW(
383  __in_opt LPCWSTR lpModuleName
384  );
385  #ifdef UNICODE
386  #define GetModuleHandle GetModuleHandleW
387  #else
388  #define GetModuleHandle GetModuleHandleA
389  #endif // !UNICODE
390 
391  typedef struct _STARTUPINFOA {
392  DWORD cb;
393  LPSTR lpReserved;
394  LPSTR lpDesktop;
395  LPSTR lpTitle;
396  DWORD dwX;
397  DWORD dwY;
398  DWORD dwXSize;
399  DWORD dwYSize;
400  DWORD dwXCountChars;
401  DWORD dwYCountChars;
402  DWORD dwFillAttribute;
403  DWORD dwFlags;
404  WORD wShowWindow;
405  WORD cbReserved2;
406  LPBYTE lpReserved2;
407  HANDLE hStdInput;
408  HANDLE hStdOutput;
409  HANDLE hStdError;
410  } STARTUPINFOA, *LPSTARTUPINFOA;
411  typedef struct _STARTUPINFOW {
412  DWORD cb;
413  LPWSTR lpReserved;
414  LPWSTR lpDesktop;
415  LPWSTR lpTitle;
416  DWORD dwX;
417  DWORD dwY;
418  DWORD dwXSize;
419  DWORD dwYSize;
420  DWORD dwXCountChars;
421  DWORD dwYCountChars;
422  DWORD dwFillAttribute;
423  DWORD dwFlags;
424  WORD wShowWindow;
425  WORD cbReserved2;
426  LPBYTE lpReserved2;
427  HANDLE hStdInput;
428  HANDLE hStdOutput;
429  HANDLE hStdError;
430  } STARTUPINFOW, *LPSTARTUPINFOW;
431  #ifdef UNICODE
432  typedef STARTUPINFOW STARTUPINFO;
433  typedef LPSTARTUPINFOW LPSTARTUPINFO;
434  #else
435  typedef STARTUPINFOA STARTUPINFO;
436  typedef LPSTARTUPINFOA LPSTARTUPINFO;
437  #endif // UNICODE
438 
439 
440  typedef struct _PROCESS_INFORMATION {
441  HANDLE hProcess;
442  HANDLE hThread;
443  DWORD dwProcessId;
444  DWORD dwThreadId;
445  } PROCESS_INFORMATION, *PPROCESS_INFORMATION, *LPPROCESS_INFORMATION;
446 
447 
448  extern "C"
449  BOOL
450  WINAPI
451  CreateProcessA(
452  __in_opt LPCSTR lpApplicationName,
453  __inout_opt LPSTR lpCommandLine,
454  __in_opt LPSECURITY_ATTRIBUTES lpProcessAttributes,
455  __in_opt LPSECURITY_ATTRIBUTES lpThreadAttributes,
456  __in BOOL bInheritHandles,
457  __in DWORD dwCreationFlags,
458  __in_opt LPVOID lpEnvironment,
459  __in_opt LPCSTR lpCurrentDirectory,
460  __in LPSTARTUPINFOA lpStartupInfo,
461  __out LPPROCESS_INFORMATION lpProcessInformation
462  );
463  extern "C"
464  BOOL
465  WINAPI
466  CreateProcessW(
467  __in_opt LPCWSTR lpApplicationName,
468  __inout_opt LPWSTR lpCommandLine,
469  __in_opt LPSECURITY_ATTRIBUTES lpProcessAttributes,
470  __in_opt LPSECURITY_ATTRIBUTES lpThreadAttributes,
471  __in BOOL bInheritHandles,
472  __in DWORD dwCreationFlags,
473  __in_opt LPVOID lpEnvironment,
474  __in_opt LPCWSTR lpCurrentDirectory,
475  __in LPSTARTUPINFOW lpStartupInfo,
476  __out LPPROCESS_INFORMATION lpProcessInformation
477  );
478  #ifdef UNICODE
479  #define CreateProcess CreateProcessW
480  #else
481  #define CreateProcess CreateProcessA
482  #endif // !UNICODE
483 
484 /*
485  extern "C"
486  VOID
487  WINAPI
488  OutputDebugStringA(
489  __in LPCSTR lpOutputString
490  );
491  extern "C"
492  VOID
493  WINAPI
494  OutputDebugStringW(
495  __in LPCWSTR lpOutputString
496  );
497  #ifdef UNICODE
498  #define OutputDebugString OutputDebugStringW
499  #else
500  #define OutputDebugString OutputDebugStringA
501  #endif // !UNICODE
502 */
503  //
504  // File structures
505  //
506  typedef struct _OVERLAPPED {
507  ULONG_PTR Internal;
508  ULONG_PTR InternalHigh;
509  union {
510  struct {
511  DWORD Offset;
512  DWORD OffsetHigh;
513  };
514 
515  PVOID Pointer;
516  };
517 
518  HANDLE hEvent;
519  } OVERLAPPED, *LPOVERLAPPED;
520 
521  //required for MSIXML project
522  extern "C"
523  VOID
524  WINAPI
525  DebugBreak(
526  VOID
527  );
528 
529  extern "C"
530  BOOL
531  WINAPI
532  CloseHandle(
533  __in HANDLE hObject
534  );
535 
536  extern "C"
537  BOOL
538  WINAPI
539  WriteFile(
540  __in HANDLE hFile,
541  __in_bcount(nNumberOfBytesToWrite) LPCVOID lpBuffer,
542  __in DWORD nNumberOfBytesToWrite,
543  __out_opt LPDWORD lpNumberOfBytesWritten,
544  __inout_opt LPOVERLAPPED lpOverlapped
545  );
546 
547  extern "C"
548  BOOL
549  WINAPI
550  ReadFile(
551  __in HANDLE hFile,
552  __out_bcount_part(nNumberOfBytesToRead, *lpNumberOfBytesRead) LPVOID lpBuffer,
553  __in DWORD nNumberOfBytesToRead,
554  __out_opt LPDWORD lpNumberOfBytesRead,
555  __inout_opt LPOVERLAPPED lpOverlapped
556  );
557 
558  extern "C"
559  int
560  WINAPI
561  lstrlenA(
562  __in LPCSTR lpString
563  );
564 
565  extern "C"
566  int
567  WINAPI
568  lstrlenW(
569  __in LPCWSTR lpString
570  );
571 
572  #ifdef UNICODE
573  #define lstrlen lstrlenW
574  #else
575  #define lstrlen lstrlenA
576  #endif // !UNICODE
577 
578  extern "C"
579  __out
580  LPSTR
581  WINAPI
582  lstrcpynA(
583  __out_ecount(iMaxLength) LPSTR lpString1,
584  __in LPCSTR lpString2,
585  __in int iMaxLength
586  );
587 
588 
589  extern "C"
590  __out
591  LPWSTR
592  WINAPI
593  lstrcpynW(
594  __out_ecount(iMaxLength) LPWSTR lpString1,
595  __in LPCWSTR lpString2,
596  __in int iMaxLength
597  );
598  #ifdef UNICODE
599  #define lstrcpyn lstrcpynW
600  #else
601  #define lstrcpyn lstrcpynA
602  #endif // !UNICODE
603 
604 
605 
606  extern "C"
607  __out
608  LPSTR
609  WINAPI
610  lstrcpyA(
611  __out LPSTR lpString1,
612  __in LPCSTR lpString2
613  );
614 
615 
616  extern "C"
617  __out
618  LPWSTR
619  WINAPI
620  lstrcpyW(
621  __out LPWSTR lpString1,
622  __in LPCWSTR lpString2
623  );
624  #ifdef UNICODE
625  #define lstrcpy lstrcpyW
626  #else
627  #define lstrcpy lstrcpyA
628  #endif // !UNICODE
629 
630  extern "C"
631  int
632  WINAPI
633  lstrcmpiA(
634  __in LPCSTR lpString1,
635  __in LPCSTR lpString2
636  );
637 
638 
639  extern "C"
640  int
641  WINAPI
642  lstrcmpiW(
643  __in LPCWSTR lpString1,
644  __in LPCWSTR lpString2
645  );
646  #ifdef UNICODE
647  #define lstrcmpi lstrcmpiW
648  #else
649  #define lstrcmpi lstrcmpiA
650  #endif // !UNICODE
651 
652 
653  #if !defined(WINAPIV)
654  #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
655  #define WINAPIV __cdecl
656  #else
657  #define WINAPIV
658  #endif
659  #endif
660 
661 
662  extern "C"
663  int
664  WINAPIV
665  wsprintfA(
666  __out LPSTR,
667  __in __format_string LPCSTR,
668  ...);
669 
670 
671  extern "C"
672  int
673  WINAPIV
674  wsprintfW(
675  __out LPWSTR,
676  __in __format_string LPCWSTR,
677  ...);
678  #ifdef UNICODE
679  #define wsprintf wsprintfW
680  #else
681  #define wsprintf wsprintfA
682  #endif // !UNICODE
683 
684  // for MSInst2 project MSICOM configuration
685 
686  #if !defined(MIDL_PASS)
687  extern "C"
688  DWORD
689  WINAPI
690  FormatMessageA(
691  DWORD dwFlags,
692  LPCVOID lpSource,
693  DWORD dwMessageId,
694  DWORD dwLanguageId,
695  LPSTR lpBuffer,
696  DWORD nSize,
697  va_list *Arguments
698  );
699 
700  extern "C"
701  DWORD
702  WINAPI
703  FormatMessageW(
704  DWORD dwFlags,
705  LPCVOID lpSource,
706  DWORD dwMessageId,
707  DWORD dwLanguageId,
708  LPWSTR lpBuffer,
709  DWORD nSize,
710  va_list *Arguments
711  );
712  #ifdef UNICODE
713  #define FormatMessage FormatMessageW
714  #else
715  #define FormatMessage FormatMessageA
716  #endif // !UNICODE
717 
718  #if defined(_M_CEE)
719  #undef FormatMessage
720  __inline
721  DWORD
722  FormatMessage(
723  DWORD dwFlags,
724  LPCVOID lpSource,
725  DWORD dwMessageId,
726  DWORD dwLanguageId,
727  LPTSTR lpBuffer,
728  DWORD nSize,
729  va_list *Arguments
730  )
731  {
732  #ifdef UNICODE
733  return FormatMessageW(
734  #else
735  return FormatMessageA(
736  #endif
737  dwFlags,
738  lpSource,
739  dwMessageId,
740  dwLanguageId,
741  lpBuffer,
742  nSize,
743  Arguments
744  );
745  }
746  #endif /* _M_CEE */
747  #endif /* MIDL_PASS */
748 
749 
750 
751  extern "C"
752  HANDLE
753  WINAPI
754  LocalFree(
755  __deref HANDLE hMem
756  );
757 
758  //end of changes nprabhudessai: 01/17/06
759 
760  // 2/13/2006 qxue: added the following function declarations for Windows MSICOM build
761  #ifndef _FILETIME_
762  #define _FILETIME_
763  typedef struct _FILETIME {
767  #endif
768 
769  extern "C"
770  LPVOID
771  WINAPI
772  VirtualAlloc(
773  __in_opt LPVOID lpAddress,
774  __in SIZE_T dwSize,
775  __in DWORD flAllocationType,
776  __in DWORD flProtect
777  );
778 
779  extern "C"
780  SIZE_T
781  WINAPI
782  VirtualQuery(
783  __in_opt LPCVOID lpAddress,
784  __out_bcount_part(dwLength, return) PMEMORY_BASIC_INFORMATION lpBuffer,
785  __in SIZE_T dwLength
786  );
787 
788  extern "C"
789  BOOL
790  WINAPI
791  GetProcessWorkingSetSize(
792  __in HANDLE hProcess,
793  __out PSIZE_T lpMinimumWorkingSetSize,
794  __out PSIZE_T lpMaximumWorkingSetSize
795  );
796 
797  extern "C"
798  DWORD
799  WINAPI
800  GetProcessHeaps(
801  __in DWORD NumberOfHeaps,
802  __out_ecount_part(NumberOfHeaps, return) PHANDLE ProcessHeaps
803  );
804 
805  extern "C"
806  __out
807  HANDLE
808  WINAPI
809  GetStdHandle(
810  __in DWORD nStdHandle
811  );
812 
813  extern "C"
814  BOOL
815  WINAPI
816  SetStdHandle(
817  __in DWORD nStdHandle,
818  __in HANDLE hHandle
819  );
820 
821  extern "C"
822  BOOL
823  WINAPI
824  GetThreadTimes(
825  __in HANDLE hThread,
826  __out LPFILETIME lpCreationTime,
827  __out LPFILETIME lpExitTime,
828  __out LPFILETIME lpKernelTime,
829  __out LPFILETIME lpUserTime
830  );
831 
832  /* Global Memory Flags */
833  #define GMEM_FIXED 0x0000
834  #define GMEM_MOVEABLE 0x0002
835  #define GMEM_NOCOMPACT 0x0010
836  #define GMEM_NODISCARD 0x0020
837  #define GMEM_ZEROINIT 0x0040
838  #define GMEM_MODIFY 0x0080
839  #define GMEM_DISCARDABLE 0x0100
840  #define GMEM_NOT_BANKED 0x1000
841  #define GMEM_SHARE 0x2000
842  #define GMEM_DDESHARE 0x2000
843  #define GMEM_NOTIFY 0x4000
844  #define GMEM_LOWER GMEM_NOT_BANKED
845  #define GMEM_VALID_FLAGS 0x7F72
846  #define GMEM_INVALID_HANDLE 0x8000
847 
848  #define GHND (GMEM_MOVEABLE | GMEM_ZEROINIT)
849  #define GPTR (GMEM_FIXED | GMEM_ZEROINIT)
850 
851  extern "C"
852  __out
853  HGLOBAL
854  WINAPI
855  GlobalFree(
856  __deref HGLOBAL hMem
857  );
858 
859  extern "C"
860  __out
861  HGLOBAL
862  WINAPI
863  GlobalAlloc (
864  __in UINT uFlags,
865  __in SIZE_T dwBytes
866  );
867 
868  extern "C"
869  DWORD
870  WINAPI
871  GetModuleFileNameA(
872  __in_opt HMODULE hModule,
873  __out_ecount_part(nSize, return + 1) char* lpFilename,
874  __in DWORD nSize
875  );
876 
877  extern "C"
878  DWORD
879  WINAPI
880  GetModuleFileNameW(
881  __in_opt HMODULE hModule,
882  __out_ecount_part(nSize, return + 1) wchar_t* lpFilename,
883  __in DWORD nSize
884  );
885  #ifdef UNICODE
886  #define GetModuleFileName GetModuleFileNameW
887  #else
888  #define GetModuleFileName GetModuleFileNameA
889  #endif // !UNICODE
890 
891  extern "C"
892  __out
893  HANDLE
894  WINAPI
895  GetCurrentProcess(
896  VOID
897  );
898 
899  extern "C"
900  DWORD
901  WINAPI
902  GetCurrentProcessId(
903  VOID
904  );
905 
906  extern "C"
907  DWORD
908  WINAPI
909  GetCurrentThreadId(
910  VOID
911  );
912 
913  extern "C"
914  __out
915  HMODULE
916  WINAPI
917  LoadLibraryA(
918  __in LPCSTR lpLibFileName
919  );
920  extern "C"
921  __out
922  HMODULE
923  WINAPI
924  LoadLibraryW(
925  __in LPCWSTR lpLibFileName
926  );
927  #ifdef UNICODE
928  #define LoadLibrary LoadLibraryW
929  #else
930  #define LoadLibrary LoadLibraryA
931  #endif // !UNICODE
932  extern "C"
933  BOOL
934  WINAPI
935  FreeLibrary (
936  __in HMODULE hLibModule
937  );
938  extern "C"
939  __out
940  HANDLE
941  WINAPI
942  CreateMutexA(
943  __in_opt LPSECURITY_ATTRIBUTES lpMutexAttributes,
944  __in BOOL bInitialOwner,
945  __in_opt LPCSTR lpName
946  );
947  extern "C"
948  __out
949  HANDLE
950  WINAPI
951  CreateMutexW(
952  __in_opt LPSECURITY_ATTRIBUTES lpMutexAttributes,
953  __in BOOL bInitialOwner,
954  __in_opt LPCWSTR lpName
955  );
956  #ifdef UNICODE
957  #define CreateMutex CreateMutexW
958  #else
959  #define CreateMutex CreateMutexA
960  #endif // !UNICODE
961 
962  extern "C"
963  BOOL
964  WINAPI
965  ReleaseMutex(
966  __in HANDLE hMutex
967  );
968 
969  extern "C"
970  BOOL
971  WINAPI
972  SetEvent(
973  __in HANDLE hEvent
974  );
975 
976  extern "C"
977  DWORD
978  WINAPI
979  WaitForSingleObject(
980  __in HANDLE hHandle,
981  __in DWORD dwMilliseconds
982  );
983 
984  extern "C"
985  __out
986  HANDLE
987  WINAPI
988  CreateFileMappingA(
989  __in HANDLE hFile,
990  __in_opt LPSECURITY_ATTRIBUTES lpFileMappingAttributes,
991  __in DWORD flProtect,
992  __in DWORD dwMaximumSizeHigh,
993  __in DWORD dwMaximumSizeLow,
994  __in_opt LPCSTR lpName
995  );
996  extern "C"
997  __out
998  HANDLE
999  WINAPI
1000  CreateFileMappingW(
1001  __in HANDLE hFile,
1002  __in_opt LPSECURITY_ATTRIBUTES lpFileMappingAttributes,
1003  __in DWORD flProtect,
1004  __in DWORD dwMaximumSizeHigh,
1005  __in DWORD dwMaximumSizeLow,
1006  __in_opt LPCWSTR lpName
1007  );
1008  #ifdef UNICODE
1009  #define CreateFileMapping CreateFileMappingW
1010  #else
1011  #define CreateFileMapping CreateFileMappingA
1012  #endif // !UNICODE
1013 
1014 
1015  extern "C"
1016  __out
1017  HANDLE
1018  WINAPI
1019  OpenFileMappingA(
1020  __in DWORD dwDesiredAccess,
1021  __in BOOL bInheritHandle,
1022  __in LPCSTR lpName
1023  );
1024 
1025  extern "C"
1026  __out
1027  HANDLE
1028  WINAPI
1029  OpenFileMappingW(
1030  __in DWORD dwDesiredAccess,
1031  __in BOOL bInheritHandle,
1032  __in LPCWSTR lpName
1033  );
1034  #ifdef UNICODE
1035  #define OpenFileMapping OpenFileMappingW
1036  #else
1037  #define OpenFileMapping OpenFileMappingA
1038  #endif // !UNICODE
1039 
1040 
1041  extern "C"
1042  __out
1043  LPVOID
1044  WINAPI
1045  MapViewOfFile(
1046  __in HANDLE hFileMappingObject,
1047  __in DWORD dwDesiredAccess,
1048  __in DWORD dwFileOffsetHigh,
1049  __in DWORD dwFileOffsetLow,
1050  __in SIZE_T dwNumberOfBytesToMap
1051  );
1052 
1053  extern "C"
1054  __out
1055  BOOL
1056  WINAPI
1057  UnmapViewOfFile(
1058  __in LPCVOID lpBaseAddress
1059  );
1060 
1061  extern "C"
1062  DWORD
1063  WINAPI
1064  WaitForMultipleObjects(
1065  __in DWORD nCount,
1066  __in_ecount(nCount) CONST HANDLE *lpHandles,
1067  __in BOOL bWaitAll,
1068  __in DWORD dwMilliseconds
1069  );
1070 
1071  extern "C"
1072  BOOL
1073  WINAPI
1074  LocalFileTimeToFileTime(
1075  __in CONST FILETIME *lpLocalFileTime,
1076  __out LPFILETIME lpFileTime
1077  );
1078 
1079  extern "C"
1080  BOOL
1081  WINAPI
1082  SystemTimeToFileTime(
1083  __in CONST SYSTEMTIME *lpSystemTime,
1084  __out LPFILETIME lpFileTime
1085  );
1086 
1087  #define WAIT_FAILED ((DWORD)0xFFFFFFFF)
1088  #define WAIT_OBJECT_0 ((STATUS_WAIT_0 ) + 0 )
1089 
1090  extern "C"
1091  BOOL
1092  WINAPI
1093  WritePrivateProfileStringA(
1094  __in_opt LPCSTR lpAppName,
1095  __in_opt LPCSTR lpKeyName,
1096  __in_opt LPCSTR lpString,
1097  __in_opt LPCSTR lpFileName
1098  );
1099 
1100  extern "C"
1101  BOOL
1102  WINAPI
1103  WritePrivateProfileStringW(
1104  __in_opt LPCWSTR lpAppName,
1105  __in_opt LPCWSTR lpKeyName,
1106  __in_opt LPCWSTR lpString,
1107  __in_opt LPCWSTR lpFileName
1108  );
1109 #ifdef UNICODE
1110 #define WritePrivateProfileString WritePrivateProfileStringW
1111 #else
1112 #define WritePrivateProfileString WritePrivateProfileStringA
1113 #endif // !UNICODE
1114 
1115 
1116  extern "C"
1117  UINT
1118  WINAPI
1119  GetPrivateProfileIntA(
1120  __in LPCSTR lpAppName,
1121  __in LPCSTR lpKeyName,
1122  __in INT nDefault,
1123  __in_opt LPCSTR lpFileName
1124  );
1125  extern "C"
1126  UINT
1127  WINAPI
1128  GetPrivateProfileIntW(
1129  __in LPCWSTR lpAppName,
1130  __in LPCWSTR lpKeyName,
1131  __in INT nDefault,
1132  __in_opt LPCWSTR lpFileName
1133  );
1134  #ifdef UNICODE
1135  #define GetPrivateProfileInt GetPrivateProfileIntW
1136  #else
1137  #define GetPrivateProfileInt GetPrivateProfileIntA
1138  #endif // !UNICODE
1139 
1140  extern "C"
1141  DWORD
1142  WINAPI
1143  GetPrivateProfileStringA(
1144  __in_opt LPCSTR lpAppName,
1145  __in_opt LPCSTR lpKeyName,
1146  __in_opt LPCSTR lpDefault,
1147  __out_ecount_part_opt(nSize, return + 1) LPSTR lpReturnedString,
1148  __in DWORD nSize,
1149  __in_opt LPCSTR lpFileName
1150  );
1151  extern "C"
1152  DWORD
1153  WINAPI
1154  GetPrivateProfileStringW(
1155  __in_opt LPCWSTR lpAppName,
1156  __in_opt LPCWSTR lpKeyName,
1157  __in_opt LPCWSTR lpDefault,
1158  __out_ecount_part_opt(nSize, return + 1) LPWSTR lpReturnedString,
1159  __in DWORD nSize,
1160  __in_opt LPCWSTR lpFileName
1161  );
1162  #ifdef UNICODE
1163  #define GetPrivateProfileString GetPrivateProfileStringW
1164  #else
1165  #define GetPrivateProfileString GetPrivateProfileStringA
1166  #endif // !UNICODE
1167 
1168  extern "C"
1169  BOOL
1170  WINAPI
1171  LookupPrivilegeValueA(
1172  __in_opt LPCSTR lpSystemName,
1173  __in LPCSTR lpName,
1174  __out PLUID lpLuid
1175  );
1176  extern "C"
1177  BOOL
1178  WINAPI
1179  LookupPrivilegeValueW(
1180  __in_opt LPCWSTR lpSystemName,
1181  __in LPCWSTR lpName,
1182  __out PLUID lpLuid
1183  );
1184  #ifdef UNICODE
1185  #define LookupPrivilegeValue LookupPrivilegeValueW
1186  #else
1187  #define LookupPrivilegeValue LookupPrivilegeValueA
1188  #endif // !UNICODE
1189 
1190 
1191  extern "C"
1192  BOOL
1193  WINAPI
1194  AdjustTokenPrivileges (
1195  __in HANDLE TokenHandle,
1196  __in BOOL DisableAllPrivileges,
1197  __in_opt PTOKEN_PRIVILEGES NewState,
1198  __in DWORD BufferLength,
1199  __out_bcount_part_opt(BufferLength, *ReturnLength) PTOKEN_PRIVILEGES PreviousState,
1200  __out_opt PDWORD ReturnLength
1201  );
1202 
1203  extern "C"
1204  VOID
1205  WINAPI
1206  InitializeCriticalSection(
1207  __out CRITICAL_SECTION* lpCriticalSection
1208  );
1209 
1210  extern "C"
1211  VOID
1212  WINAPI
1213  EnterCriticalSection(
1214  __inout CRITICAL_SECTION* lpCriticalSection
1215  );
1216 
1217  extern "C"
1218  VOID
1219  WINAPI
1220  LeaveCriticalSection(
1221  __inout CRITICAL_SECTION* lpCriticalSection
1222  );
1223 
1224  #if (_WIN32_WINNT >= 0x0403)
1225  extern "C"
1226  BOOL
1227  WINAPI
1228  InitializeCriticalSectionAndSpinCount(
1229  __out CRITICAL_SECTION* lpCriticalSection,
1230  __in DWORD dwSpinCount
1231  );
1232 
1233  extern "C"
1234  DWORD
1235  WINAPI
1236  SetCriticalSectionSpinCount(
1237  __inout CRITICAL_SECTION* lpCriticalSection,
1238  __in DWORD dwSpinCount
1239  );
1240  #endif
1241 
1242  #if(_WIN32_WINNT >= 0x0400)
1243  extern "C"
1244  BOOL
1245  WINAPI
1246  TryEnterCriticalSection(
1247  __inout CRITICAL_SECTION* lpCriticalSection
1248  );
1249  #endif /* _WIN32_WINNT >= 0x0400 */
1250 
1251  extern "C"
1252  VOID
1253  WINAPI
1254  DeleteCriticalSection(
1255  __inout CRITICAL_SECTION* lpCriticalSection
1256  );
1257 
1258 
1259  #endif // WIN32
1260 
1261 
1262  #endif // _WINBASE_
1263 #endif // WIN32 && !_USE_MSI_COM
1264 
1265 // this must be the *last* file included
1266 #include "ProtectedSource/Epilog.h"
1267 
1268 #endif // PDCwinbase_h
wchar_t WCHAR
Definition: PDCwchar.h:23
PVOID PSID
Definition: PDCwtypes.h:200
DLL_BASE_EXIM void Sleep(unsigned long inMilliseconds)
char CHAR
Definition: PDCwtypes.h:338
signed char BOOL
Definition: PDCwtypes.h:101
MIDL_uhyper DWORDLONG
Definition: PDCwtypes.h:198
DWORD dwLowDateTime
Definition: PDCwtypes.h:251
struct _FILETIME * LPFILETIME
int INT
Definition: PDCwtypes.h:96
struct _FILETIME FILETIME
HINSTANCE HMODULE
Definition: PDCwtypes.h:311
CHAR __RPC_FAR * LPSTR
Definition: PDCwtypes.h:365
#define WINAPI
Definition: PDCwindows.h:52
unsigned long SIZE_T
Definition: Msi_objidl.h:17
unsigned long DWORD_PTR
Definition: Msi_atlbase.h:34
void * LPVOID
Definition: PDCwtypes.h:136
unsigned int UINT
Definition: PDCwtypes.h:110
struct _FILETIME * PFILETIME
BYTE far * LPBYTE
Definition: PDCwtypes.h:143
Definition: PDCwtypes.h:249
void * HANDLE
Definition: PDCwtypes.h:306
const CHAR __RPC_FAR * LPCSTR
Definition: PDCwtypes.h:367
void VOID
Definition: PDCwtypes.h:157
const WCHAR __RPC_FAR * LPCWSTR
Definition: PDCwtypes.h:369
const TCHAR __RPC_FAR * LPCTSTR
Definition: PDCwtypes.h:375
CONST void * LPCVOID
Definition: PDCwtypes.h:409
#define CONST
Definition: PDCwtypes.h:408
WCHAR * LPWSTR
Definition: PDCwtypes.h:353
long LONG
Definition: PDCwtypes.h:119
void __RPC_FAR * PVOID
Definition: PDCwtypes.h:149
void __RPC_FAR * HGLOBAL
Definition: PDCwtypes.h:403
unsigned short WORD
Definition: PDCwtypes.h:109
ULONG cb
Definition: Msi_objbase.h:25
TCHAR __RPC_FAR * LPTSTR
Definition: PDCwtypes.h:371
DWORD __RPC_FAR * LPDWORD
Definition: PDCwtypes.h:125
Definition: PDCwtypes.h:202
struct _SECURITY_ATTRIBUTES __RPC_FAR * LPSECURITY_ATTRIBUTES
Definition: PDCwtypes.h:501
#define MAX_PATH
Definition: PDCwinbase.h:77
DWORD dwHighDateTime
Definition: PDCwtypes.h:252
#define FAR
Definition: PDCwtypes.h:68
unsigned long DWORD
Definition: PDCwtypes.h:121
HANDLE * PHANDLE
Definition: PDCwtypes.h:308
DLL_BASE_EXIM ErrorCode GetLastError()