Mercurial > emacs
comparison src/w32.c @ 100192:038d7d21b786
* w32.c (init_environment): Don't free handle to library shell32.dll.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Wed, 03 Dec 2008 14:13:42 +0000 |
parents | a77c2abc7237 |
children | dcc7f5970d5c |
comparison
equal
deleted
inserted
replaced
100191:56005ec017c3 | 100192:038d7d21b786 |
---|---|
1441 if (stat ("C:/.emacs", &ignored) < 0) | 1441 if (stat ("C:/.emacs", &ignored) < 0) |
1442 { | 1442 { |
1443 HRESULT profile_result; | 1443 HRESULT profile_result; |
1444 /* Dynamically load ShGetFolderPath, as it won't exist on versions | 1444 /* Dynamically load ShGetFolderPath, as it won't exist on versions |
1445 of Windows 95 and NT4 that have not been updated to include | 1445 of Windows 95 and NT4 that have not been updated to include |
1446 MSIE 5. Also we don't link with shell32.dll by default. */ | 1446 MSIE 5. */ |
1447 HMODULE shell32_dll; | |
1448 ShGetFolderPath_fn get_folder_path; | 1447 ShGetFolderPath_fn get_folder_path; |
1449 shell32_dll = GetModuleHandle ("shell32.dll"); | |
1450 get_folder_path = (ShGetFolderPath_fn) | 1448 get_folder_path = (ShGetFolderPath_fn) |
1451 GetProcAddress (shell32_dll, "SHGetFolderPathA"); | 1449 GetProcAddress (GetModuleHandle ("shell32.dll"), "SHGetFolderPathA"); |
1452 | 1450 |
1453 if (get_folder_path != NULL) | 1451 if (get_folder_path != NULL) |
1454 { | 1452 { |
1455 profile_result = get_folder_path (NULL, CSIDL_APPDATA, NULL, | 1453 profile_result = get_folder_path (NULL, CSIDL_APPDATA, NULL, |
1456 0, default_home); | 1454 0, default_home); |
1457 | 1455 |
1458 /* If we can't get the appdata dir, revert to old behavior. */ | 1456 /* If we can't get the appdata dir, revert to old behavior. */ |
1459 if (profile_result == S_OK) | 1457 if (profile_result == S_OK) |
1460 env_vars[0].def_value = default_home; | 1458 env_vars[0].def_value = default_home; |
1461 } | 1459 } |
1462 | |
1463 /* Unload shell32.dll, it is not needed anymore. */ | |
1464 FreeLibrary (shell32_dll); | |
1465 } | 1460 } |
1466 | 1461 |
1467 /* Get default locale info and use it for LANG. */ | 1462 /* Get default locale info and use it for LANG. */ |
1468 if (GetLocaleInfo (LOCALE_USER_DEFAULT, | 1463 if (GetLocaleInfo (LOCALE_USER_DEFAULT, |
1469 LOCALE_SABBREVLANGNAME | LOCALE_USE_CP_ACP, | 1464 LOCALE_SABBREVLANGNAME | LOCALE_USE_CP_ACP, |