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.

55 lines
1.8 KiB

  1. #ifdef CM_CMAK
  2. #define wsprintfU wsprintfW
  3. #define GetPrivateProfileStringU GetPrivateProfileStringW
  4. #define WritePrivateProfileStringU WritePrivateProfileStringW
  5. #endif
  6. //+----------------------------------------------------------------------------
  7. //
  8. // Function: EraseDunSettingsEapData
  9. //
  10. // Synopsis: This function erases the CustomAuthData key of the EAP settings
  11. // for the given section and CMS file
  12. //
  13. // Arguments: LPCTSTR pszSection - section name to erase the CustomAuthData from
  14. // LPCTSTR pszCmsFile - cms file to erase the data from
  15. //
  16. // Returns: HRESULT - standard COM style error codes
  17. //
  18. // History: quintinb Created 03/27/00
  19. // tomkel Copied from profwiz project 08/09/2001
  20. //
  21. //+----------------------------------------------------------------------------
  22. HRESULT EraseDunSettingsEapData(LPCTSTR pszSection, LPCTSTR pszCmsFile)
  23. {
  24. if ((NULL == pszSection) || (NULL == pszCmsFile) ||
  25. (TEXT('\0') == pszSection[0]) || (TEXT('\0') == pszCmsFile[0]))
  26. {
  27. return E_INVALIDARG;
  28. }
  29. HRESULT hr = S_OK;
  30. int iLineNum = 0;
  31. DWORD dwRet = -1;
  32. TCHAR szKeyName[MAX_PATH+1];
  33. TCHAR szLine[MAX_PATH+1];
  34. while(0 != dwRet)
  35. {
  36. wsprintfU(szKeyName, TEXT("%S%d"), c_pszCmEntryDunServerCustomAuthData, iLineNum);
  37. dwRet = GetPrivateProfileStringU(pszSection, szKeyName, TEXT(""), szLine, MAX_PATH, pszCmsFile);
  38. if (dwRet)
  39. {
  40. if (0 == WritePrivateProfileStringU(pszSection, szKeyName, NULL, pszCmsFile))
  41. {
  42. DWORD dwGLE = GetLastError();
  43. hr = HRESULT_FROM_WIN32(dwGLE);
  44. break;
  45. }
  46. }
  47. iLineNum++;
  48. }
  49. return hr;
  50. }