00001
00002
00003
00004
00005
00006 #include "stdafx.h"
00007 #include "FdmApp.h"
00008 #include "vmsRegisteredApp.h"
00009
00010 #ifdef _DEBUG
00011 #undef THIS_FILE
00012 static char THIS_FILE[]=__FILE__;
00013 #define new DEBUG_NEW
00014 #endif
00015
00016 vmsRegisteredApp::vmsRegisteredApp()
00017 {
00018
00019 }
00020
00021 vmsRegisteredApp::~vmsRegisteredApp()
00022 {
00023
00024 }
00025
00026 CString vmsRegisteredApp::GetFullPath(LPCSTR pszExeName)
00027 {
00028 CRegKey key;
00029 CString str = "Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\";
00030 str += pszExeName;
00031 if (ERROR_SUCCESS == key.Open (HKEY_LOCAL_MACHINE, str, KEY_READ))
00032 {
00033 char szPath [MY_MAX_PATH];
00034 DWORD dw = sizeof (szPath);
00035
00036 if (ERROR_SUCCESS == key.QueryValue (szPath, "Path", &dw))
00037 {
00038 str = szPath;
00039 if (str [str.GetLength () - 1] != '\\' && str [str.GetLength () - 1] != '/')
00040 str += '\\';
00041 str += pszExeName;
00042 return str;
00043 }
00044
00045 if (ERROR_SUCCESS == key.QueryValue (szPath, NULL, &dw))
00046 {
00047 str = szPath;
00048 if (str != "" && str [0] == '"')
00049 {
00050 str.Delete (0);
00051 str.Delete (str.GetLength () - 1);
00052 }
00053 return str;
00054 }
00055 }
00056
00057 return "";
00058 }