Mercurial > pidgin.yaz
annotate src/win_gaim.c @ 7126:eda3de6dacbb
[gaim-migrate @ 7693]
closes former bug (current patch) # 816124
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Thu, 02 Oct 2003 13:06:42 +0000 |
parents | 4eee806af511 |
children | e28728795a45 |
rev | line source |
---|---|
4490 | 1 /* |
2 * win_aim.c | |
3 * | |
4 * Author: Herman Bloggs <hermanator12002@yahoo.com> | |
5 * Date: June, 2002 | |
6 * Description: Entry point for win32 gaim, and various win32 dependant | |
7 * routines. | |
8 */ | |
9 #include <windows.h> | |
10 #include <stdlib.h> | |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
11 #include <string.h> |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
12 #include <stdio.h> |
4490 | 13 |
14 /* | |
15 * GLOBALS | |
16 */ | |
17 __declspec(dllimport) HINSTANCE gaimexe_hInstance; | |
18 | |
19 /* | |
20 * LOCALS | |
21 */ | |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
22 static char msg1[] = "The following duplicate of "; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
23 static char msg2[] = " has been found in your dll search path and will likely\x0d\x0a" |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
24 "cause Gaim to malfunction:\x0d\x0a\x0d\x0a"; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
25 |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
26 static char msg3[] = "\x0d\x0a\x0d\x0aWould you like to rename this dll to "; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
27 static char msg4[] = ".prob in order to avoid any possible conflicts?\x0d\x0a" |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
28 "\x0d\x0a" |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
29 "Note: Doing so will likely cause the application that installed this dll to stop functioning.\x0d\x0a" |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
30 "You may wish to inform the author of the responsible application so that future versions\x0d\x0a" |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
31 "do not cause 'Dll Hell'."; |
4490 | 32 |
33 /* | |
34 * PROTOTYPES | |
35 */ | |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
36 int (*gaim_main)( HINSTANCE, int, char** ) = NULL; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
37 |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
38 static void check_dll(char* dll, char* orig) { |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
39 char tmp[MAX_PATH]; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
40 char *last; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
41 |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
42 if(SearchPath(NULL, dll, NULL, MAX_PATH, tmp, &last)) { |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
43 char* patha = (char*)malloc(strlen(orig) + strlen(dll) + 4); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
44 strcpy(patha, orig); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
45 strcat(patha, "\\"); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
46 strcat(patha, dll); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
47 /* Make sure that 2 paths are not the same */ |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
48 if(strcasecmp(patha, tmp) != 0) { |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
49 char *warning = (char*)malloc(strlen(msg1)+ |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
50 strlen(msg2)+ |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
51 strlen(msg3)+ |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
52 strlen(msg4)+ |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
53 strlen(tmp)+ |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
54 (strlen(dll)*2)+4); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
55 sprintf(warning, "%s%s%s%s%s%s%s", msg1, dll, msg2, tmp, msg3, dll, msg4); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
56 if(MessageBox(NULL, warning, "Gaim Warning", MB_YESNO | MB_TOPMOST)==IDYES) { |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
57 char *newname = (char*)malloc(strlen(tmp)+6); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
58 /* Rename offending dll */ |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
59 sprintf(newname, "%s%s", tmp, ".prob"); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
60 if(rename(tmp, newname) != 0) { |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
61 MessageBox(NULL, "Error renaming file.", NULL, MB_OK | MB_TOPMOST); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
62 } |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
63 else |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
64 check_dll(dll, orig); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
65 free(newname); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
66 } |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
67 free(warning); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
68 } |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
69 free(patha); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
70 } |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
71 } |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
72 |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
73 static void dll_hell_check(char* gtkpath) { |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
74 HANDLE myHandle; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
75 WIN32_FIND_DATA fd; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
76 char* srchstr = (char*)malloc(strlen(gtkpath) + 8); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
77 |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
78 sprintf(srchstr, "%s%s", gtkpath, "\\*.dll"); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
79 myHandle = FindFirstFile(srchstr, &fd ); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
80 if(myHandle != INVALID_HANDLE_VALUE) { |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
81 check_dll(fd.cFileName, gtkpath); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
82 while(FindNextFile(myHandle, &fd)) { |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
83 check_dll(fd.cFileName, gtkpath); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
84 } |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
85 } |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
86 free(srchstr); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
87 } |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
88 |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
89 BOOL read_reg_string(HKEY key, char* sub_key, char* val_name, LPBYTE data, LPDWORD data_len) { |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
90 HKEY hkey; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
91 BOOL ret = FALSE; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
92 int retv; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
93 |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
94 if(ERROR_SUCCESS == RegOpenKeyEx(key, |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
95 sub_key, |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
96 0, KEY_QUERY_VALUE, &hkey)) { |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
97 if(ERROR_SUCCESS == (retv=RegQueryValueEx(hkey, val_name, 0, NULL, data, data_len))) |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
98 ret = TRUE; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
99 else { |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
100 printf("Error reading registry string value: %d\n", retv); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
101 } |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
102 RegCloseKey(key); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
103 } |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
104 return ret; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
105 } |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
106 |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
107 void run_dll_check() { |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
108 char path[MAX_PATH]; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
109 DWORD plen = MAX_PATH; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
110 int gotreg=FALSE; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
111 |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
112 /* Dll Hell Check.. Only run check if we are the same gaim as found in the |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
113 gaim registry key */ |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
114 if(!(gotreg = read_reg_string(HKEY_LOCAL_MACHINE, "SOFTWARE\\gaim", "", (LPBYTE)&path, &plen))) |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
115 gotreg = read_reg_string(HKEY_CURRENT_USER, "SOFTWARE\\gaim", "", (LPBYTE)&path, &plen); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
116 |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
117 if(gotreg) { |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
118 char modpath[MAX_PATH]; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
119 |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
120 strcat(path, "\\gaim.exe"); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
121 GetModuleFileName(NULL, modpath, MAX_PATH); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
122 if(strcasecmp(path, modpath) == 0) { |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
123 plen = MAX_PATH; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
124 if(!(gotreg = read_reg_string(HKEY_LOCAL_MACHINE, "SOFTWARE\\GTK\\2.0", "Path", (LPBYTE)&path, &plen))) |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
125 gotreg = read_reg_string(HKEY_CURRENT_USER, "SOFTWARE\\GTK\\2.0", "Path", (LPBYTE)&path, &plen); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
126 if(gotreg) { |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
127 strcat(path, "\\bin"); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
128 dll_hell_check(path); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
129 } |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
130 } |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
131 } |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
132 } |
4490 | 133 |
134 #ifdef __GNUC__ | |
135 # ifndef _stdcall | |
136 # define _stdcall __attribute__((stdcall)) | |
137 # endif | |
138 #endif | |
139 | |
140 int _stdcall | |
141 WinMain (struct HINSTANCE__ *hInstance, | |
142 struct HINSTANCE__ *hPrevInstance, | |
143 char *lpszCmdLine, | |
144 int nCmdShow) | |
145 { | |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
146 char gaimdir[MAX_PATH]; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
147 char *point; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
148 HMODULE hmod; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
149 |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
150 /* If GAIM_NO_DLL_CHECK is set, don't run the dll check */ |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
151 if(!getenv("GAIM_NO_DLL_CHECK")) |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
152 run_dll_check(); |
6816
5aeba37b303c
[gaim-migrate @ 7356]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4490
diff
changeset
|
153 |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
154 /* Load exception handler if we have it */ |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
155 GetModuleFileName(NULL, gaimdir, MAX_PATH); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
156 if((point=strstr(gaimdir, "gaim.exe"))) { |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
157 point[0] = '\0'; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
158 strcat(gaimdir, "exchndl.dll"); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
159 LoadLibrary(gaimdir); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
160 } |
6816
5aeba37b303c
[gaim-migrate @ 7356]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4490
diff
changeset
|
161 |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
162 /* Now we are ready for Gaim .. */ |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
163 if((hmod=LoadLibrary("gaim.dll"))) { |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
164 gaim_main = (void*)GetProcAddress(hmod, "gaim_main"); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
165 } |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
166 |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
167 if(!gaim_main) { |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
168 MessageBox(NULL, "Error loading gaim.dll entry point.", NULL, MB_OK | MB_TOPMOST); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
169 return 0; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
170 } |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
171 else |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
172 return gaim_main (hInstance, __argc, __argv); |
4490 | 173 } |
174 |