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
71 lines
1.9 KiB
// dvdstub.cpp : Defines the entry point for the console application.
|
|
//
|
|
|
|
#pragma once
|
|
#include <Windows.h>
|
|
#include <stdio.h>
|
|
#ifndef MAXPATH
|
|
#define MAXPATH 1024
|
|
#endif
|
|
|
|
int APIENTRY WinMain(HINSTANCE hInstance,
|
|
HINSTANCE hPrevInstance,
|
|
PSTR pCmdLine,
|
|
int nCmdShow)
|
|
{
|
|
try{
|
|
STARTUPINFO si;
|
|
PROCESS_INFORMATION pi;
|
|
|
|
ZeroMemory( &si, sizeof(si) );
|
|
si.cb = sizeof(si);
|
|
ZeroMemory( &pi, sizeof(pi) );
|
|
TCHAR filePos[MAXPATH];
|
|
ZeroMemory(filePos, sizeof(TCHAR)*MAXPATH);
|
|
TCHAR filePath[MAXPATH];
|
|
ZeroMemory(filePath, sizeof(TCHAR)*MAXPATH);
|
|
DWORD szPath = (sizeof(TCHAR)/sizeof(BYTE))*MAXPATH;
|
|
HKEY wmpKey = 0;
|
|
LONG temp = RegOpenKeyEx(
|
|
HKEY_LOCAL_MACHINE, // handle to open key
|
|
TEXT("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\wmplayer.exe"), // subkey name
|
|
0, // reserved
|
|
KEY_READ, // security access mask
|
|
&wmpKey // handle to open key
|
|
);
|
|
DWORD tempType = 0;
|
|
temp = RegQueryValueEx(
|
|
wmpKey, // handle to key
|
|
TEXT("Path"), // value name
|
|
0, // reserved
|
|
&tempType, // type buffer
|
|
(BYTE*)filePath, // data buffer
|
|
&szPath // size of data buffer
|
|
);
|
|
TCHAR *namePos;
|
|
DWORD retVal = 0;
|
|
retVal = SearchPath(
|
|
(TCHAR *)filePath, // search path
|
|
TEXT("wmplayer"), // file name
|
|
TEXT(".exe"), // file extension
|
|
MAXPATH, // size of path buffer
|
|
filePos, // path buffer
|
|
&namePos // address of file name in path
|
|
);
|
|
TCHAR commandArgs[] = TEXT(" /device:dvd");
|
|
BOOL retBool = CreateProcess(
|
|
filePos,
|
|
commandArgs,
|
|
NULL,
|
|
NULL,
|
|
FALSE,
|
|
0,
|
|
NULL,
|
|
NULL,
|
|
&si, // Pointer to STARTUPINFO structure.
|
|
&pi // Pointer to PROCESS_INFORMATION structure.
|
|
);
|
|
}
|
|
catch(...){}
|
|
return 0;
|
|
}
|