if (GetStringFromStringTab(g_inst_header->install_reg_key_ptr)[0])
{
HKEY hKey;
if ( RegOpenKeyEx((HKEY)g_inst_header->install_reg_rootkey,GetStringFromStringTab(g_inst_header->install_reg_key_ptr),0,KEY_READ,&hKey) == ERROR_SUCCESS)
{
int l = sizeof(buf);
int t=REG_SZ;
if (RegQueryValueEx(hKey,GetStringFromStringTab(g_inst_header->install_reg_value_ptr),NULL,&t,buf,&l ) == ERROR_SUCCESS && t == REG_SZ && buf[0])
{
char tmp[5];
char *e;
char *p=buf;
while (*p && *p != '\"') p++;
if (*p)
{
char *p2=++p;
while (*p2 && *p2 != '\"') p2++;
if (*p2)
{
*p2=0;
}
else p=buf;
}
else p=buf;
// p is the path now, check for .exe extension
e=p;
while (*e) e++;
while (e>p && *e != '.' && *e != '\\') e--;
mini_memcpy(tmp,e,4);
tmp[4]=0;
if (!lstrcmpi(tmp,".exe")) // check extension
{
DWORD d;
e[4]=0;
d=GetFileAttributes(p); // get the file attributes
if (d == (DWORD)-1 || !(d&FILE_ATTRIBUTE_DIRECTORY)) // if not exists, or not directory, then remove suffix