mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 19:42:48 -05:00
Factor out Windows utility function get_system_dir().
The code to find out the location of the c:\windows\system32 directory was already present, in load_system32_dll(). Now it's moved out into a function of its own, so it can be called in other contexts.
This commit is contained in:
@ -8,18 +8,10 @@
|
||||
|
||||
HMODULE load_system32_dll(const char *libname)
|
||||
{
|
||||
static char *sysdir = NULL;
|
||||
static size_t sysdirsize = 0;
|
||||
char *fullpath;
|
||||
HMODULE ret;
|
||||
|
||||
if (!sysdir) {
|
||||
size_t len;
|
||||
while ((len = GetSystemDirectory(sysdir, sysdirsize)) >= sysdirsize)
|
||||
sgrowarray(sysdir, sysdirsize, len);
|
||||
}
|
||||
|
||||
fullpath = dupcat(sysdir, "\\", libname);
|
||||
fullpath = dupcat(get_system_dir(), "\\", libname);
|
||||
ret = LoadLibrary(fullpath);
|
||||
sfree(fullpath);
|
||||
return ret;
|
||||
|
Reference in New Issue
Block a user