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.

78 lines
2.4 KiB

  1. #ifndef __UTIL
  2. #define __UTIL
  3. #include <windows.h>
  4. #define LOGFILENAME "AdvpackExt.log"
  5. #define ROUNDUP2( x, n ) ((((ULONG)(x)) + (((ULONG)(n)) - 1 )) & ~(((ULONG)(n)) - 1 ))
  6. #define MINIMUM_VM_ALLOCATION 0x10000
  7. #define SUBALLOCATOR_ALIGNMENT 8
  8. #define StrToInt TextToUnsignedNum
  9. #ifndef ASSERT
  10. #ifdef DEBUG
  11. #define ASSERT( a ) (( a ) ? 1 : Assert( #a, __FILE__, __LINE__ ))
  12. #else
  13. #define ASSERT( a )
  14. #endif
  15. #endif
  16. extern HANDLE g_hLogFile;
  17. extern "C"
  18. {
  19. struct _SUBALLOCATOR
  20. {
  21. PVOID VirtualListTerminator;
  22. PVOID *VirtualList;
  23. PCHAR NextAvailable;
  24. PCHAR LastAvailable;
  25. ULONG GrowSize;
  26. };
  27. typedef struct _SUBALLOCATOR SUBALLOCATOR, *PSUBALLOCATOR;
  28. PVOID __fastcall SubAllocate(IN HANDLE hAllocator, IN ULONG Size);
  29. VOID DestroySubAllocator(IN HANDLE hAllocator);
  30. HANDLE CreateSubAllocator(IN ULONG InitialCommitSize, IN ULONG GrowthCommitSize);
  31. }
  32. HLOCAL ResizeBuffer(IN HLOCAL BufferHandle, IN DWORD Size, IN BOOL Moveable);
  33. VOID MyLowercase(IN OUT LPSTR String);
  34. DWORD GenerateUniqueClientId();
  35. BOOL MySetupDecompressOrCopyFile(IN LPCSTR SourceFile, IN LPCSTR TargetFile);
  36. LPSTR CombinePaths(IN LPCSTR ParentPath, IN LPCSTR ChildPath, OUT LPSTR TargetPath);
  37. BOOL FixTimeStampOnCompressedFile(IN LPCSTR FileName);
  38. BOOL MyMapViewOfFile(IN LPCSTR FileName, OUT ULONG *FileSize, OUT HANDLE *FileHandle, OUT PVOID *MapBase);
  39. VOID MyUnmapViewOfFile(IN HANDLE FileHandle, IN PVOID MapBase );
  40. VOID __fastcall ConvertToCompressedFileName(IN OUT LPSTR FileName);
  41. LPTSTR __fastcall MySubAllocStrDup(IN HANDLE SubAllocator, IN LPCSTR String);
  42. BOOL GetFieldString(LPSTR lpszLine, int iField, LPSTR lpszField, int cbSize);
  43. void ConvertVersionStrToDwords(LPSTR pszVer, LPDWORD pdwVer, LPDWORD pdwBuild);
  44. DWORD GetStringField(LPSTR szStr, UINT uField, LPSTR szBuf, UINT cBufSize);
  45. BOOL GetHashidFromINF(LPCTSTR lpFileName, LPTSTR lpszHash, DWORD dwSize);
  46. PCHAR ScanForSequence(IN PCHAR Buffer, IN ULONG BufferLength, IN PCHAR Sequence, IN ULONG SequenceLength);
  47. LPSTR ScanForChar(IN LPSTR Buffer, IN CHAR SearchFor, IN ULONG MaxLength);
  48. ULONG __fastcall TextToUnsignedNum(IN LPCSTR Text);
  49. LPTSTR PathFindFileName(LPCTSTR pPath);
  50. LPTSTR PathFindExtension(LPCTSTR pszPath);
  51. LPSTR StrDup(LPCSTR psz);
  52. DWORD MyFileSize(PCSTR pszFile);
  53. void GetLanguageString(LPTSTR lpszLang);
  54. BOOL CenterWindow (HWND hwndChild, HWND hwndParent);
  55. void InitLogFile();
  56. void WriteToLog(char *pszFormatString, ...);
  57. #endif