From dc3edb13b7ab579de51496193b78e8c26790d512 Mon Sep 17 00:00:00 2001 From: kramm Date: Mon, 9 Jun 2008 10:23:13 +0000 Subject: [PATCH] removed os.c dependency --- installer/Makefile | 11 ++++------- installer/installer.c | 45 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 8 deletions(-) diff --git a/installer/Makefile b/installer/Makefile index bcf9952..9a3c764 100644 --- a/installer/Makefile +++ b/installer/Makefile @@ -36,20 +36,17 @@ license.o: $(LICENSE) installer.o: installer.c installer.h depack.h archive.h ../lib/os.h $(CC) -c installer.c -o installer.o -os.o: ../lib/os.c ../lib/os.h - $(CC) -c ../lib/os.c -o os.o - installer.coff: installer.rc swftools.ico installer.h $(WINDRES) installer.rc -O coff -F pe-i386 -o installer.coff -%.exe: %.c installer.o license.o depack.o archive.o depack.h os.o installer.coff Makefile - $(CC) installer.o depack.o license.o archive.o os.o installer.coff $< -o $@ $(LIBS) +%.exe: %.c installer.o license.o depack.o archive.o depack.h installer.coff Makefile + $(CC) installer.o depack.o license.o archive.o installer.coff $< -o $@ $(LIBS) $(STRIP) $@ ./makegui $@ #upx -9 --best $@ 2>/dev/null || true -#installer.exe: installer.c depack.o archive.o depack.h crnfiles.o os.o installer.coff Makefile -# $(CC) installer.c depack.o archive.o crnfiles.o os.o installer.coff -o installer.exe $(LIBS) +#installer.exe: installer.c depack.o archive.o depack.h crnfiles.o installer.coff Makefile +# $(CC) installer.c depack.o archive.o crnfiles.o installer.coff -o installer.exe $(LIBS) # $(STRIP) installer.exe # #./makegui installer.exe # #upx -9 --best installer.exe 2>/dev/null || true diff --git a/installer/installer.c b/installer/installer.c index b17d23e..2b96e62 100644 --- a/installer/installer.c +++ b/installer/installer.c @@ -56,7 +56,7 @@ static HINSTANCE me; #define USER_SETMESSAGE 0x7f01 -void tball(HDC hdc, double px, double py, double sx, double sy) +static void tball(HDC hdc, double px, double py, double sx, double sy) { MoveToEx(hdc, 75.25*sx+px, -32.50*sy+py, 0); LineTo(hdc, 74.75*sx+px, -24.80*sy+py); LineTo(hdc, 74.95*sx+px, -3.45*sy+py); LineTo(hdc, 75.25*sx+px, -32.50*sy+py); @@ -100,6 +100,49 @@ void tball(HDC hdc, double px, double py, double sx, double sy) LineTo(hdc, -25.70*sx+px, 128.45*sy+py); LineTo(hdc, -118.85*sx+px, 143.85*sy+py); } +static char* concatPaths(const char*base, const char*add) +{ + int l1 = strlen(base); + int l2 = strlen(add); + int pos = 0; + char*n = 0; + while(l1 && base[l1-1] == '\\') + l1--; + while(pos < l2 && add[pos] == '\\') + pos++; + + n = (char*)malloc(l1 + (l2-pos) + 2); + memcpy(n,base,l1); + n[l1]='\\'; + strcpy(&n[l1+1],&add[pos]); + return n; +} + +static int setRegistryEntry(char*key,char*value) +{ + HKEY hkey1; + HKEY hkey2; + int ret1 = -1, ret2= -1; + ret1 = RegCreateKey(HKEY_CURRENT_USER, key, &hkey1); + if(config_forAllUsers) { + ret2 = RegCreateKey(HKEY_LOCAL_MACHINE, key, &hkey2); + } + + if(ret1 && ret2) { + fprintf(stderr, "registry: CreateKey %s failed\n", key); + return 0; + } + if(!ret1) + ret1 = RegSetValue(hkey1, NULL, REG_SZ, value, strlen(value)+1); + if(!ret2) + ret2 = RegSetValue(hkey2, NULL, REG_SZ, value, strlen(value)+1); + if(ret1 && ret2) { + fprintf(stderr, "registry: SetValue %s failed\n", key); + return 0; + } + return 1; +} + static HWND wnd_background = 0; LRESULT CALLBACK WindowFunc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { -- 1.7.10.4