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.

82 lines
3.6 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1999 - 2000
  6. //
  7. // File: utilityfunctions.h
  8. //
  9. //--------------------------------------------------------------------------
  10. // UtilityFunctions.h: interface for the CUtilityFunctions class.
  11. //
  12. //////////////////////////////////////////////////////////////////////
  13. #if !defined(AFX_UTILITYFUNCTIONS_H__C97C8493_D457_11D2_845B_0010A4F1B732__INCLUDED_)
  14. #define AFX_UTILITYFUNCTIONS_H__C97C8493_D457_11D2_845B_0010A4F1B732__INCLUDED_
  15. #if _MSC_VER > 1000
  16. #pragma once
  17. #endif // _MSC_VER > 1000
  18. #ifndef NO_STRICT
  19. #ifndef STRICT
  20. #define STRICT 1
  21. #endif
  22. #endif /* NO_STRICT */
  23. #include <WINDOWS.H>
  24. #include <STDIO.H>
  25. #include <TCHAR.H>
  26. #define fdifRECURSIVE 0x1
  27. class CUtilityFunctions
  28. {
  29. public:
  30. static LPWSTR CopyTSTRStringToUnicode(LPCTSTR tszInputString);
  31. static LPSTR CopyTSTRStringToAnsi(LPCTSTR tszInputString, LPSTR szOutputBuffer = NULL, unsigned int iBufferLength = 0);
  32. static LPTSTR CopyUnicodeStringToTSTR(LPCWSTR wszInputString, LPTSTR tszOutputBuffer = NULL, unsigned int iBufferLength = 0);
  33. static LPTSTR CopyAnsiStringToTSTR(LPCSTR szInputString, LPTSTR tszOutputBuffer = NULL, unsigned int iBufferLength = 0);
  34. static LPTSTR CopyString(LPCTSTR tszInputString);
  35. static size_t UTF8ToUnicode(LPCSTR lpSrcStr, LPWSTR lpDestStr, size_t cchDest);
  36. static size_t UTF8ToUnicodeCch(LPCSTR lpSrcStr, size_t cchSrc, LPWSTR lpDestStr, size_t cchDest);
  37. CUtilityFunctions();
  38. virtual ~CUtilityFunctions();
  39. static LPTSTR ExpandPath(LPCTSTR lpPath);
  40. static bool UnMungePathIfNecessary(LPTSTR tszPossibleBizarrePath);
  41. static bool FixupDeviceDriverPathIfNecessary(LPTSTR tszPossibleBaseDeviceDriverName, unsigned int iBufferLength);
  42. static bool ContainsWildCardCharacter(LPCTSTR tszPathToSearch);
  43. static bool CopySymbolFileToSymbolTree(LPCTSTR tszImageModuleName, LPTSTR * lplptszOriginalPathToSymbolFile, LPCTSTR tszSymbolTreePath);
  44. // static bool IsDirectoryPath(LPCTSTR tszFilePath);
  45. static void PrintMessageString(DWORD dwMessageId);
  46. // Define the callback method for FindDebugInfoFileEx()
  47. typedef BOOL (*PFIND_DEBUG_FILE_CALLBACK)(HANDLE FileHandle, LPTSTR tszFileName, PVOID CallerData);
  48. static HANDLE FindDebugInfoFileEx(LPTSTR tszFileName, LPTSTR SymbolPath, LPTSTR DebugFilePath, PFIND_DEBUG_FILE_CALLBACK Callback, PVOID CallerData);
  49. static HANDLE fnFindDebugInfoFileEx(LPTSTR tszFileName, LPTSTR SymbolPath, LPTSTR DebugFilePath, PFIND_DEBUG_FILE_CALLBACK Callback, PVOID CallerData, DWORD flag);
  50. static bool GetSymbolFileFromServer(LPCTSTR tszServerInfo, LPCTSTR tszFileName, DWORD num1, DWORD num2, DWORD num3, LPTSTR tszFilePath);
  51. static void EnsureTrailingBackslash(LPTSTR tsz);
  52. static HANDLE FindDebugInfoFileEx2(LPTSTR tszFileName, LPTSTR SymbolPath, PFIND_DEBUG_FILE_CALLBACK Callback, PVOID CallerData);
  53. static bool ScavengeForSymbolFiles(LPCTSTR tszSymbolPathStart, LPCTSTR tszSymbolToSearchFor, PFIND_DEBUG_FILE_CALLBACK Callback, PVOID CallerData, LPHANDLE lpFileHandle, int iRecurseDepth);
  54. // Output Assistance!
  55. static inline void OutputLineOfStars() {
  56. _tprintf(TEXT("*******************************************************************************\n"));
  57. };
  58. static inline void OutputLineOfDashes() {
  59. _tprintf(TEXT("-------------------------------------------------------------------------------\n"));
  60. };
  61. protected:
  62. static LPTSTR ReAlloc(LPTSTR tszOutputPathBuffer, LPTSTR * ptszOutputPathPointer, size_t size);
  63. enum { MAX_RECURSE_DEPTH = 30 };
  64. static DWORD m_dwGetLastError;
  65. };
  66. #endif // !defined(AFX_UTILITYFUNCTIONS_H__C97C8493_D457_11D2_845B_0010A4F1B732__INCLUDED_)