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.

140 lines
3.4 KiB

  1. //-----------------------------------------------------------------------------
  2. //
  3. // @doc
  4. //
  5. // @module ValidateFunctions.h | Function declarations for validation
  6. //
  7. // Author: Christopher Ambler (cambler)
  8. //
  9. // 01 May 00 - Created - cambler
  10. //
  11. // Copyright <cp> 1999-2000 Microsoft Corporation. All Rights Reserved.
  12. //
  13. //-----------------------------------------------------------------------------
  14. #pragma once
  15. #define VALIDPHONECHAR "0123456789";
  16. // VL_SignInName
  17. const long VALIDATENAME_PPREG = 1;
  18. const long VALIDATENAME_LOGIN = 2;
  19. const long VALIDATEPASSWORD_PASSPORT = 1;
  20. const long VALIDATEPASSWORD_MSN = 2;
  21. //
  22. // Validation routines
  23. //
  24. // Validate email address
  25. HRESULT VL_EmailAddress(
  26. CStringW &szEmail,
  27. BOOL bOptional,
  28. long nLeftMax,
  29. long nRightMax);
  30. // Validate a birthdate is under nYears Old
  31. bool VL_IsUnder(
  32. DATE Birthdate,
  33. long nYearsOld);
  34. // Validate location
  35. HRESULT VL_Location(
  36. CStringW &szCountryCode,
  37. CStringW &szRegionGEOID,
  38. CStringW &szPostalCode,
  39. long &lReturnFlags,
  40. long lLCID,
  41. IDictionaryEx* pIDict = NULL);
  42. // Validate nickname
  43. HRESULT VL_NickName(
  44. CStringW &szName,
  45. long nMaxLen);
  46. // Validate occupation
  47. bool VL_Occupation(
  48. CStringW &szOccupation);
  49. // Validate password
  50. HRESULT VL_Password(
  51. CStringW &szPassword,
  52. CStringW &szConfirm,
  53. CStringW &szMembername,
  54. long nMinLen,
  55. long nMaxLen,
  56. long nRuleset = VALIDATEPASSWORD_PASSPORT);
  57. // Validate PIN
  58. HRESULT VL_PIN(
  59. CStringW &in_PIN, // @parm Password to validated
  60. CStringW &in_ConfirmPIN, // @parm Confirmation password
  61. CStringW &in_membername); // @parm Membername
  62. // Validate Birthdate
  63. HRESULT VL_ProfileBirthdate(
  64. long nDay,
  65. long nMonth,
  66. CStringW szYear,
  67. long flags,
  68. COleDateTime* ptBirthdate);
  69. // Validate Birthdate
  70. HRESULT VL_ProfileBirthdate(
  71. long nDay,
  72. long nMonth,
  73. long nYear,
  74. long flags,
  75. COleDateTime* ptBirthdate);
  76. // Validate secret question and answer
  77. HRESULT VL_ProfileSecretQA(
  78. CStringW &szSecretQ,
  79. CStringW &szSecretA);
  80. // Validate secret question and answer more thoroughly
  81. HRESULT VL_SecretQandA(
  82. CStringW &szNewSQ,
  83. CStringW &szNewSA,
  84. CStringW &szMName,
  85. CStringW &szCurrPW,
  86. long nMinLen,
  87. long nMaxLen);
  88. // Validate sign-in name
  89. HRESULT VL_SignInName(
  90. CStringW &Name,
  91. long nMinLen,
  92. long nMaxLen,
  93. long nRuleset = VALIDATENAME_PPREG);
  94. // Validate domain - blocked, managed, etc.
  95. HRESULT VL_ManagedDomain(
  96. CStringW &szSignInName,
  97. bool bSignin = TRUE);
  98. // Validate timezone
  99. bool VL_TimeZone(
  100. CStringW &szTimeZone);
  101. // Validate a string has no invalid chars in it
  102. bool VL_ValidString(
  103. CStringW &szSource,
  104. CStringW &szChars);
  105. //validate phone number, the first param is the phone number to be validated
  106. // the second param is a string that contains all characters that is valid
  107. bool VL_PhoneNumber(CStringW &szSource, CStringW &szChars);
  108. long IsSiteIdValid(
  109. ULONG ulID,
  110. BSTR szRU);
  111. bool IsUSTerritory(LPCWSTR szCountryCode);
  112. class CProfile;
  113. class CTicket;
  114. // Check whether the user is a signed-in user or not.
  115. // If ppProfile or ppTicket is not NULL, the profile or ticket generated
  116. // during the checking process will be returned to the caller.
  117. // REMEMBER: the caller must delete the object it gets.
  118. bool AlreadyLoggedIn(CProfile & cProfiles);