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.

144 lines
4.0 KiB

  1. // CA_SRData.cpp : Defines the entry point for the DLL application.
  2. //
  3. #include "stdafx.h"
  4. BOOL APIENTRY DllMain( HANDLE hModule,
  5. DWORD ul_reason_for_call,
  6. LPVOID lpReserved
  7. )
  8. {
  9. return TRUE;
  10. }
  11. const static TCHAR *g_ppszFileList[] =
  12. {
  13. _T("SR\\1033\\af031033.am"),
  14. _T("SR\\1033\\af031033.env"),
  15. _T("SR\\1033\\af031033.nsc"),
  16. _T("SR\\1033\\ai041033.am"),
  17. _T("SR\\1033\\ai041033.env"),
  18. _T("SR\\1033\\ai041033.nsc"),
  19. _T("SR\\1033\\am031033.am"),
  20. _T("SR\\1033\\am031033.env"),
  21. _T("SR\\1033\\am031033.nsc"),
  22. _T("SR\\1033\\ci031033.am"),
  23. _T("SR\\1033\\ci031033.env"),
  24. _T("SR\\1033\\ci031033.nsc"),
  25. _T("SR\\1033\\l1033.adc"),
  26. _T("SR\\1033\\l1033.art"),
  27. _T("SR\\1033\\l1033.cw"),
  28. _T("SR\\1033\\l1033.dlm"),
  29. _T("SR\\1033\\l1033.ini"),
  30. _T("SR\\1033\\l1033.ngr"),
  31. _T("SR\\1033\\l1033.phn"),
  32. _T("SR\\1033\\l1033.smp"),
  33. _T("SR\\1033\\l1033.tre"),
  34. _T("SR\\1033\\l1033.vec"),
  35. _T("SR\\1033\\p1033.dlm"),
  36. _T("SR\\1033\\p1033.ngr"),
  37. _T("SR\\1033\\s1033.dlm"),
  38. _T("SR\\1033\\s1033.ngr"),
  39. _T("SR\\2052\\af032052.am"),
  40. _T("SR\\2052\\af032052.env"),
  41. _T("SR\\2052\\af032052.nsc"),
  42. _T("SR\\2052\\am032052.am"),
  43. _T("SR\\2052\\am032052.env"),
  44. _T("SR\\2052\\am032052.nsc"),
  45. _T("SR\\2052\\l2052.adc"),
  46. _T("SR\\2052\\l2052.art"),
  47. _T("SR\\2052\\l2052.cw"),
  48. _T("SR\\2052\\l2052.dlm"),
  49. _T("SR\\2052\\l2052.ini"),
  50. _T("SR\\2052\\l2052.ngr"),
  51. _T("SR\\2052\\l2052.phn"),
  52. _T("SR\\2052\\l2052.smp"),
  53. _T("SR\\2052\\l2052.tre"),
  54. _T("SR\\2052\\l2052.vec"),
  55. _T("SR\\2052\\p2052.dlm"),
  56. _T("SR\\2052\\p2052.ngr"),
  57. _T("SR\\1041\\af031041.am"),
  58. _T("SR\\1041\\af031041.env"),
  59. _T("SR\\1041\\af031041.nsc"),
  60. _T("SR\\1041\\am031041.am"),
  61. _T("SR\\1041\\am031041.env"),
  62. _T("SR\\1041\\am031041.nsc"),
  63. _T("SR\\1041\\ci031041.am"),
  64. _T("SR\\1041\\ci031041.env"),
  65. _T("SR\\1041\\ci031041.nsc"),
  66. _T("SR\\1041\\l1041.adc"),
  67. _T("SR\\1041\\l1041.art"),
  68. _T("SR\\1041\\l1041.cw"),
  69. _T("SR\\1041\\l1041.dlm"),
  70. _T("SR\\1041\\l1041.ini"),
  71. _T("SR\\1041\\l1041.ngr"),
  72. _T("SR\\1041\\l1041.phn"),
  73. _T("SR\\1041\\l1041.smp"),
  74. _T("SR\\1041\\l1041.tre"),
  75. _T("SR\\1041\\l1041.vec"),
  76. _T("SR\\1041\\p1041.dlm"),
  77. _T("SR\\1041\\p1041.ngr"),
  78. _T("SR\\1041\\s1041.dlm"),
  79. _T("SR\\1041\\s1041.ngr"),
  80. _T("Lexicon\\1033\\lsr1033.lxa"),
  81. _T("Lexicon\\1033\\r1033sr.lxa"),
  82. _T("Lexicon\\2052\\lsr2052.lxa"),
  83. _T("Lexicon\\2052\\r2052sr.lxa"),
  84. _T("Lexicon\\1041\\lsr1041.lxa"),
  85. _T("Lexicon\\1041\\llts1041.lxa"),
  86. _T("")
  87. };
  88. UINT __stdcall CA_SRDatafiles(HANDLE hInstall)
  89. {
  90. HRESULT hr;
  91. TCHAR pszCommonPath[MAX_PATH] = _T("");
  92. // Get the path to the system's CommonProgramFiles folder
  93. hr = SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES_COMMON,
  94. NULL, 0, pszCommonPath);
  95. if (hr != S_OK)
  96. {
  97. hr = E_FAIL; // If file is not there (S_FALSE) then cannot continue
  98. }
  99. else
  100. {
  101. _tcscat(pszCommonPath, _T("\\SpeechEngines\\Microsoft\\"));
  102. }
  103. TCHAR pszFile[MAX_PATH];
  104. for (ULONG ul = 0; SUCCEEDED(hr) && *g_ppszFileList[ul] != _T('\0'); ul++)
  105. {
  106. //cat name
  107. pszFile[0] = _T('\0');
  108. _tcscat(pszFile, pszCommonPath);
  109. _tcscat(pszFile, g_ppszFileList[ul]);
  110. //open file if exists
  111. HANDLE hFile = CreateFile(pszFile, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
  112. if (hFile != INVALID_HANDLE_VALUE)
  113. {
  114. //touch file
  115. SYSTEMTIME st;
  116. FILETIME ft;
  117. GetSystemTime(&st);
  118. if(SystemTimeToFileTime(&st, &ft))
  119. {
  120. SetFileTime(hFile, NULL, NULL, &ft);
  121. }
  122. ::CloseHandle(hFile);
  123. }
  124. // Keep running even if one file fails
  125. }
  126. return 0;
  127. }