From d762e60cd8733a7995b4243624480bcbc35726a3 Mon Sep 17 00:00:00 2001 From: kichik Date: Wed, 25 Sep 2002 13:10:21 +0000 Subject: [PATCH] 6 more bytes down git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1183 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/exehead/exec.c | 33 +++++++++++++++++- Source/exehead/util.c | 79 ------------------------------------------- Source/exehead/util.h | 3 -- 3 files changed, 32 insertions(+), 83 deletions(-) diff --git a/Source/exehead/exec.c b/Source/exehead/exec.c index 1673576a..3cd348ac 100644 --- a/Source/exehead/exec.c +++ b/Source/exehead/exec.c @@ -237,7 +237,38 @@ static int NSISCALL ExecuteEntry(entry *entry_) mystrcpy(state_output_directory,buf1); } else update_status_text_from_lang(LANGID_CREATEDIR,buf1); - recursive_create_directory(buf1); + { + char *tp; + char *p; + p=buf1; + while (*p == ' ') p=CharNext(p); + if (*p) { + tp=CharNext(p); + if (*(WORD*)tp == CHAR2_TO_WORD(':','\\')) p=tp+2; + else if (*(WORD*)p == CHAR2_TO_WORD('\\','\\')) + { + int x; + for (x = 0; x < 2; x ++) + { + while (*p != '\\' && *p) p=CharNext(p); // skip host then share + if (*p) p=CharNext(p); + } + + } + else return 0; + while (*p) + { + while (*p != '\\' && *p) p=CharNext(p); + if (!*p) CreateDirectory(buf1,NULL); + else + { + *p=0; + CreateDirectory(buf1,NULL); + *p++ = '\\'; + } + } + } + } } return 0; case EW_IFFILEEXISTS: { diff --git a/Source/exehead/util.c b/Source/exehead/util.c index b503d28a..db0a7065 100644 --- a/Source/exehead/util.c +++ b/Source/exehead/util.c @@ -286,40 +286,6 @@ BOOL NSISCALL MoveFileOnReboot(LPCTSTR pszExisting, LPCTSTR pszNew) } #endif -void NSISCALL recursive_create_directory(char *directory) -{ - char *tp; - char *p; - p=directory; - while (*p == ' ') p=CharNext(p); - if (!*p) return; - tp=CharNext(p); - if (*(WORD*)tp == CHAR2_TO_WORD(':','\\')) p=tp+2; - else if (*(WORD*)p == CHAR2_TO_WORD('\\','\\')) - { - int x; - for (x = 0; x < 2; x ++) - { - while (*p != '\\' && *p) p=CharNext(p); // skip host then share - if (*p) p=CharNext(p); - } - - } - else return; - while (*p) - { - while (*p != '\\' && *p) p=CharNext(p); - if (!*p) CreateDirectory(directory,NULL); - else - { - *p=0; - CreateDirectory(directory,NULL); - *p++ = '\\'; - } - } -} - - void NSISCALL myRegGetStr(HKEY root, const char *sub, const char *name, char *out) { HKEY hKey; @@ -590,48 +556,3 @@ void NSISCALL log_write(int close) #endif - -#ifdef NSIS_SUPPORT_CREATESHORTCUT -/*int NSISCALL CreateShortCut(HWND hwnd, LPCSTR pszShortcutFile, LPCSTR pszIconFile, int iconindex, LPCSTR pszExe, LPCSTR pszArg, LPCSTR workingdir, int showmode, int hotkey) -{ - HRESULT hres; - int rv=1; - IShellLink* psl; - hres=OleInitialize(NULL); - if (hres != S_FALSE && hres != S_OK) return rv; - - hres = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, - &IID_IShellLink, (void **) &psl); - if (SUCCEEDED(hres)) - { - IPersistFile* ppf; - - hres = psl->lpVtbl->QueryInterface(psl,&IID_IPersistFile, (void **) &ppf); - if (SUCCEEDED(hres)) - { - - hres = psl->lpVtbl->SetPath(psl,pszExe); - psl->lpVtbl->SetWorkingDirectory(psl,workingdir); - if (showmode) psl->lpVtbl->SetShowCmd(psl,showmode); - if (hotkey) psl->lpVtbl->SetHotkey(psl,(unsigned short)hotkey); - if (pszIconFile) psl->lpVtbl->SetIconLocation(psl,pszIconFile,iconindex); - if (pszArg) - { - psl->lpVtbl->SetArguments(psl,pszArg); - } - - if (SUCCEEDED(hres)) - { - WCHAR wsz[1024]; - MultiByteToWideChar(CP_ACP, 0, pszShortcutFile, -1, wsz, 1024); - hres=ppf->lpVtbl->Save(ppf,(const WCHAR*)wsz,TRUE); - if (SUCCEEDED(hres)) rv=0; - } - ppf->lpVtbl->Release(ppf); - } - psl->lpVtbl->Release(psl); - } - OleUninitialize(); - return rv; -}*/ -#endif//NSIS_SUPPORT_CREATESHORTCUT diff --git a/Source/exehead/util.h b/Source/exehead/util.h index 2537c5f6..d22a4172 100644 --- a/Source/exehead/util.h +++ b/Source/exehead/util.h @@ -1,8 +1,6 @@ #include "config.h" #include "lang.h" -void NSISCALL recursive_create_directory(char *directory); - extern char ps_tmpbuf[NSIS_MAX_STRLEN*2]; char * NSISCALL process_string(char *out, const char *in); char * NSISCALL process_string_fromtab(char *out, int offs); @@ -45,7 +43,6 @@ void * NSISCALL my_GlobalAlloc(DWORD dwBytes); void NSISCALL doRMDir(char *buf, int recurse); HANDLE NSISCALL myOpenFile(const char *fn, DWORD da, DWORD cd); -int NSISCALL CreateShortCut(HWND hwnd, LPCSTR pszShortcutFile, LPCSTR pszIconFile, int iconindex, LPCSTR pszExe, LPCSTR pszArg, LPCSTR workingdir, int showmode, int hotkey); int NSISCALL validpathspec(char *ubuf); char * NSISCALL addtrailingslash(char *str); char NSISCALL lastchar(const char *str);