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.

42 lines
1.1 KiB

  1. // regcpl.cpp : Defines the entry point for the application.
  2. //
  3. #include "stdafx.h"
  4. int APIENTRY WinMain(HINSTANCE hInstance,
  5. HINSTANCE hPrevInstance,
  6. LPSTR lpCmdLine,
  7. int nCmdShow)
  8. {
  9. BOOL b_ControliniModified = 0;
  10. TCHAR pszPathToControlIni[MAX_PATH] = _T("");
  11. DWORD dwRetVal = 0;
  12. // Get the path to the system's CommonProgramFiles folder
  13. if( SUCCEEDED( SHGetFolderPath( NULL, CSIDL_PROGRAM_FILES_COMMON |CSIDL_FLAG_CREATE,
  14. NULL, 0, pszPathToControlIni ) ) )
  15. {
  16. TCHAR pszShortPath[MAX_PATH] = _T("");
  17. if (::GetShortPathName(pszPathToControlIni, pszShortPath, sizeof(pszShortPath)/sizeof(TCHAR)))
  18. {
  19. _tcscat(pszShortPath, _T("\\Microsoft Shared\\Speech\\sapi.cpl"));
  20. // Modify control.ini on win95 and NT4
  21. b_ControliniModified = WritePrivateProfileString("MMCPL", "sapi.cpl",
  22. pszShortPath, "control.ini");
  23. }
  24. }
  25. if( !b_ControliniModified )
  26. {
  27. return ERROR_INSTALL_FAILURE;
  28. }
  29. else
  30. {
  31. return ERROR_SUCCESS;
  32. }
  33. }