Commit fc1e5789 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

Do a SearchPath before opening the file to improve compatibility with

the native regedit.
parent 4cb9c590
...@@ -168,14 +168,33 @@ BOOL PerformRegAction(REGEDIT_ACTION action, LPSTR s) ...@@ -168,14 +168,33 @@ BOOL PerformRegAction(REGEDIT_ACTION action, LPSTR s)
} }
while(filename[0]) { while(filename[0]) {
reg_file = fopen(filename, "r"); char* realname = NULL;
if (reg_file) { int size;
processRegLines(reg_file, doSetValue); size=SearchPath(NULL,filename,NULL,0,NULL,NULL);
} else { if (size>0)
{
realname=HeapAlloc(GetProcessHeap(),0,size);
size=SearchPath(NULL,filename,NULL,size,realname,NULL);
}
if (size==0)
{
fprintf(stderr,"%s: File not found \"%s\" (%ld)\n",
getAppName(),filename,GetLastError());
exit(1);
}
reg_file = fopen(realname, "r");
if (reg_file==NULL)
{
perror(""); perror("");
fprintf(stderr,"%s: Can't open file \"%s\"\n", getAppName(), filename); fprintf(stderr,"%s: Can't open file \"%s\"\n", getAppName(), filename);
exit(1); exit(1);
} }
processRegLines(reg_file, doSetValue);
if (realname)
{
HeapFree(GetProcessHeap(),0,realname);
fclose(reg_file);
}
get_file_name(&s, filename); get_file_name(&s, filename);
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment