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.

71 lines
1.9 KiB

  1. // dvdstub.cpp : Defines the entry point for the console application.
  2. //
  3. #pragma once
  4. #include <Windows.h>
  5. #include <stdio.h>
  6. #ifndef MAXPATH
  7. #define MAXPATH 1024
  8. #endif
  9. int APIENTRY WinMain(HINSTANCE hInstance,
  10. HINSTANCE hPrevInstance,
  11. PSTR pCmdLine,
  12. int nCmdShow)
  13. {
  14. try{
  15. STARTUPINFO si;
  16. PROCESS_INFORMATION pi;
  17. ZeroMemory( &si, sizeof(si) );
  18. si.cb = sizeof(si);
  19. ZeroMemory( &pi, sizeof(pi) );
  20. TCHAR filePos[MAXPATH];
  21. ZeroMemory(filePos, sizeof(TCHAR)*MAXPATH);
  22. TCHAR filePath[MAXPATH];
  23. ZeroMemory(filePath, sizeof(TCHAR)*MAXPATH);
  24. DWORD szPath = (sizeof(TCHAR)/sizeof(BYTE))*MAXPATH;
  25. HKEY wmpKey = 0;
  26. LONG temp = RegOpenKeyEx(
  27. HKEY_LOCAL_MACHINE, // handle to open key
  28. TEXT("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\wmplayer.exe"), // subkey name
  29. 0, // reserved
  30. KEY_READ, // security access mask
  31. &wmpKey // handle to open key
  32. );
  33. DWORD tempType = 0;
  34. temp = RegQueryValueEx(
  35. wmpKey, // handle to key
  36. TEXT("Path"), // value name
  37. 0, // reserved
  38. &tempType, // type buffer
  39. (BYTE*)filePath, // data buffer
  40. &szPath // size of data buffer
  41. );
  42. TCHAR *namePos;
  43. DWORD retVal = 0;
  44. retVal = SearchPath(
  45. (TCHAR *)filePath, // search path
  46. TEXT("wmplayer"), // file name
  47. TEXT(".exe"), // file extension
  48. MAXPATH, // size of path buffer
  49. filePos, // path buffer
  50. &namePos // address of file name in path
  51. );
  52. TCHAR commandArgs[] = TEXT(" /device:dvd");
  53. BOOL retBool = CreateProcess(
  54. filePos,
  55. commandArgs,
  56. NULL,
  57. NULL,
  58. FALSE,
  59. 0,
  60. NULL,
  61. NULL,
  62. &si, // Pointer to STARTUPINFO structure.
  63. &pi // Pointer to PROCESS_INFORMATION structure.
  64. );
  65. }
  66. catch(...){}
  67. return 0;
  68. }