Leaked source code of windows server 2003
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.

79 lines
3.6 KiB

  1. //*************************************************************
  2. //
  3. // Copyright (c) Microsoft Corporation 1998
  4. // All rights reserved
  5. //
  6. // common.hxx
  7. //
  8. //*************************************************************
  9. #include <nt.h>
  10. #include <ntrtl.h>
  11. #include <nturtl.h>
  12. #include <windows.h>
  13. #include <userenv.h>
  14. #include <msi.h>
  15. #include <assert.h>
  16. #include <wchar.h>
  17. #include "appevt.h"
  18. #include "cres.h"
  19. #include "app.h"
  20. #include "evt.hxx"
  21. #include "dbg.hxx"
  22. #include "cutil.hxx"
  23. #include "list.hxx"
  24. #if defined(_X86_)
  25. #define DEFAULT_ARCHITECTURE PROCESSOR_ARCHITECTURE_INTEL
  26. #elif defined(_AMD64_)
  27. #define DEFAULT_ARCHITECTURE PROCESSOR_ARCHITECTURE_AMD64
  28. #elif defined(_IA64_)
  29. #define DEFAULT_ARCHITECTURE PROCESSOR_ARCHITECTURE_IA64
  30. #else
  31. #define DEFAULT_ARCHITECTURE PROCESSOR_ARCHITECTURE_UNKNOWN
  32. #endif
  33. // User32.dll
  34. typedef WINUSERAPI int (WINAPI LOADSTRINGW)(HINSTANCE hInstance, UINT uID, LPWSTR lpBuffer, int nBufferMax);
  35. typedef WINUSERAPI DWORD (WINAPI MSGWAITFORMULTIPLEOBJECTS)(DWORD nCount,CONST HANDLE *pHandles,BOOL fWaitAll,DWORD dwMilliseconds,DWORD dwWakeMask);
  36. typedef WINUSERAPI BOOL (WINAPI PEEKMESSAGEW)(LPMSG lpMsg,HWND hWnd,UINT wMsgFilterMin,UINT wMsgFilterMax,UINT wRemoveMsg);
  37. typedef WINUSERAPI BOOL (WINAPI TRANSLATEMESSAGE)(CONST MSG *lpMsg);
  38. typedef WINUSERAPI LRESULT (WINAPI DISPATCHMESSAGEW)(CONST MSG *lpMsg);
  39. typedef WINUSERAPI HWINSTA (WINAPI GETPROCESSWINDOWSTATION)();
  40. typedef WINUSERAPI BOOL (WINAPI CLOSEWINDOWSTATION)(HWINSTA hWinSta);
  41. typedef WINUSERAPI BOOL (WINAPI GETUSEROBJECTINFORMATIONW)(HANDLE hObj,int nIndex,PVOID pvInfo,DWORD nLength,LPDWORD lpnLengthNeeded);
  42. extern LOADSTRINGW * pfnLoadStringW;
  43. extern MSGWAITFORMULTIPLEOBJECTS * pfnMsgWaitForMultipleObjects;
  44. extern PEEKMESSAGEW * pfnPeekMessageW;
  45. extern TRANSLATEMESSAGE * pfnTranslateMessage;
  46. extern DISPATCHMESSAGEW * pfnDispatchMessageW;
  47. extern GETPROCESSWINDOWSTATION * pfnGetProcessWindowStation;
  48. extern CLOSEWINDOWSTATION * pfnCloseWindowStation;
  49. extern GETUSEROBJECTINFORMATIONW * pfnGetUserObjectInformationW;
  50. // Msi.dll
  51. typedef INSTALLUILEVEL (WINAPI MSISETINTERNALUI)(INSTALLUILEVEL dwUILevel, HWND *phWnd);
  52. typedef UINT (WINAPI MSICONFIGUREPRODUCTEXW)(LPCWSTR szProduct, int iInstallLevel, INSTALLSTATE eInstallState, LPCWSTR szCommandLine);
  53. typedef UINT (WINAPI MSIPROVIDECOMPONENTFROMDESCRIPTORW)(LPCWSTR szDescriptor, LPWSTR lpPathBuf, DWORD *pcchPathBuf, DWORD *pcchArgsOffset);
  54. typedef UINT (WINAPI MSIDECOMPOSEDESCRIPTORW)(LPCWSTR szDescriptor, LPWSTR szProductCode, LPWSTR szFeatureId, LPWSTR szComponentCode, DWORD* pcchArgsOffset);
  55. typedef UINT (WINAPI MSIGETPRODUCTINFOW)(LPCWSTR szProduct, LPCWSTR szAttribute, LPWSTR lpValueBuf, DWORD *pcchValueBuf);
  56. typedef UINT (WINAPI MSIADVERTISESCRIPTW)(LPCWSTR szScriptFile, DWORD dwFlags, PHKEY phRegData, BOOL fRemoveItems);
  57. typedef INSTALLSTATE (WINAPI MSIQUERYPRODUCTSTATEW)(LPCWSTR szProduct);
  58. typedef UINT (WINAPI MSIISPRODUCTELEVATEDW)(LPCWSTR szProduct, BOOL *pfElevated);
  59. typedef UINT (WINAPI MSIREINSTALLPRODUCTW)(LPCWSTR szProduct, DWORD szReinstallMode);
  60. extern MSISETINTERNALUI * gpfnMsiSetInternalUI;
  61. extern MSICONFIGUREPRODUCTEXW * gpfnMsiConfigureProductEx;
  62. extern MSIPROVIDECOMPONENTFROMDESCRIPTORW * gpfnMsiProvideComponentFromDescriptor;
  63. extern MSIDECOMPOSEDESCRIPTORW * gpfnMsiDecomposeDescriptor;
  64. extern MSIGETPRODUCTINFOW * gpfnMsiGetProductInfo;
  65. extern MSIADVERTISESCRIPTW * gpfnMsiAdvertiseScript;
  66. extern MSIQUERYPRODUCTSTATEW * gpfnMsiQueryProductState;
  67. extern MSIISPRODUCTELEVATEDW * gpfnMsiIsProductElevated;
  68. extern MSIREINSTALLPRODUCTW * gpfnMsiReinstallProduct;