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.

83 lines
2.1 KiB

  1. /* ----------------------------------------------------------------------
  2. Module: ULS.DLL (Service Provider)
  3. File: sputils.h
  4. Content: This file contains the help functions for the service provider.
  5. History:
  6. 10/15/96 Chu, Lon-Chan [lonchanc]
  7. Created.
  8. Copyright (c) Microsoft Corporation 1996-1997
  9. ---------------------------------------------------------------------- */
  10. #ifndef _ILS_SP_UTILS_H_
  11. #define _ILS_SP_UTILS_H_
  12. #include <pshpack8.h>
  13. inline BOOL MyIsBadWritePtr ( VOID *p, ULONG cb )
  14. {
  15. return (p == NULL || IsBadWritePtr (p, cb));
  16. }
  17. inline BOOL MyIsBadReadPtr ( VOID *p, ULONG cb )
  18. {
  19. return (p == NULL || IsBadReadPtr (p, cb));
  20. }
  21. inline BOOL MyIsBadExecPtr ( VOID *p, ULONG cb )
  22. {
  23. return MyIsBadReadPtr (p, cb);
  24. }
  25. inline BOOL MyIsWindow ( HWND h )
  26. {
  27. return (h != NULL && IsWindow (h));
  28. }
  29. inline BOOL MyIsGoodString ( const TCHAR *psz )
  30. {
  31. return (psz != NULL && *psz != TEXT ('\0'));
  32. }
  33. inline BOOL MyIsBadString ( const TCHAR *psz )
  34. {
  35. return (psz == NULL || *psz == TEXT ('\0'));
  36. }
  37. TCHAR *My_strdup ( const TCHAR *pszToDup );
  38. inline TCHAR *DuplicateGoodString ( const TCHAR *pszSrc )
  39. {
  40. return (MyIsGoodString (pszSrc) ? My_strdup (pszSrc) : NULL);
  41. }
  42. BOOL KeepUiResponsive ( VOID );
  43. VOID GetGuidString ( GUID *pGuid, TCHAR *pszGuid ); // guid --> string
  44. VOID GetStringGuid ( TCHAR *pszGuid, GUID *pGuid ); // string --> guid
  45. INT HexChar2Val ( TCHAR c );
  46. BOOL IsValidGuid ( GUID *pGuid );
  47. VOID GetLongString ( LONG, TCHAR * ); // long --> string
  48. LONG GetStringLong ( TCHAR *pszVal ); // string --> long
  49. VOID GetIPAddressString ( TCHAR *pszIPAddress, DWORD dwIPAddress );
  50. ULONG My_lstrlen ( const TCHAR *psz );
  51. VOID My_lstrcpy ( TCHAR *pszDst, const TCHAR *pszSrc );
  52. INT My_lstrcmpi ( const TCHAR *p, const TCHAR *q );
  53. TCHAR *My_strchr ( const TCHAR *psz, TCHAR c );
  54. BOOL My_isspace ( TCHAR ch );
  55. BOOL IsSameMemory ( const BYTE *pb1, const BYTE *pb2, DWORD cbSize );
  56. BYTE *MyBinDup ( const BYTE *pbToDup, ULONG cbToDup );
  57. BOOL GetRegistrySettings ( VOID );
  58. BOOL GetRegValueLong ( HKEY hKey, const TCHAR *pszKey, LONG *plValue, LONG lDefValue );
  59. #include <poppack.h>
  60. #endif // _ILS_SP_UTILS_H_