RegDLL now sets the current directory to the DLL directory (Patch #646306 )

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1872 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2002-12-03 20:33:17 +00:00
parent 1403530beb
commit e6af406ab2
2 changed files with 20 additions and 27 deletions

View file

@ -937,6 +937,11 @@ static int NSISCALL ExecuteEntry(entry *entry_)
char *buf0=process_string_fromparm_tobuf(0x00); char *buf0=process_string_fromparm_tobuf(0x00);
char *buf1=process_string_fromparm_tobuf(0x11); char *buf1=process_string_fromparm_tobuf(0x11);
// suggested by Kevin Gadd (janusfury)
lstrcpy(buf3, buf0);
trimslashtoend(buf3);
SetCurrentDirectory(buf3);
h=LoadLibrary(buf0); h=LoadLibrary(buf0);
if (h) if (h)
{ {

View file

@ -1,5 +1,6 @@
#include <windows.h> #include <windows.h>
#include <shlobj.h> #include <shlobj.h>
#include <shellapi.h>
#include "util.h" #include "util.h"
#include "state.h" #include "state.h"
#include "config.h" #include "config.h"
@ -72,38 +73,25 @@ void * NSISCALL my_GlobalAlloc(DWORD dwBytes) {
#ifdef NSIS_SUPPORT_RMDIR #ifdef NSIS_SUPPORT_RMDIR
void NSISCALL doRMDir(char *buf, int recurse) void NSISCALL doRMDir(char *buf, int recurse)
{ {
if (recurse && is_valid_instpath(buf)) if (is_valid_instpath(buf))
{ {
int i=mystrlen(buf); if (recurse) {
HANDLE h; SHFILEOPSTRUCT op;
WIN32_FIND_DATA fd;
lstrcat(buf,"\\*.*"); op.hwnd=0;
h = FindFirstFile(buf,&fd); op.wFunc=FO_DELETE;
if (h != INVALID_HANDLE_VALUE) buf[mystrlen(buf)+1]=0;
{ op.pFrom=buf;
do op.pTo=0;
{
if (fd.cFileName[0] != '.' || op.fFlags=FOF_NOERRORUI|FOF_SILENT|FOF_NOCONFIRMATION;
(fd.cFileName[1] != '.' && fd.cFileName[1]))
{ SHFileOperation(&op);
mystrcpy(buf+i+1,fd.cFileName);
if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) doRMDir(buf,recurse);
else
{
update_status_text_from_lang(LANG_DELETEFILE,buf);
if (fd.dwFileAttributes & FILE_ATTRIBUTE_READONLY)
SetFileAttributes(buf,fd.dwFileAttributes^FILE_ATTRIBUTE_READONLY);
DeleteFile(buf);
}
}
} while (FindNextFile(h,&fd));
FindClose(h);
} }
buf[i]=0; // fix buffer else RemoveDirectory(buf);
} }
log_printf2("RMDir: RemoveDirectory(\"%s\")",buf); log_printf2("RMDir: RemoveDirectory(\"%s\")",buf);
update_status_text_from_lang(LANG_REMOVEDIR,buf); update_status_text_from_lang(LANG_REMOVEDIR,buf);
RemoveDirectory(buf);
} }
#endif//NSIS_SUPPORT_RMDIR #endif//NSIS_SUPPORT_RMDIR