cleanup_exit(1);
}
-typedef BOOL (WINAPI *p_FlashWindowEx_t)(PFLASHWINFO);
-static p_FlashWindowEx_t p_FlashWindowEx = NULL;
+DECL_WINDOWS_FUNCTION(static, BOOL, FlashWindowEx, (PFLASHWINFO));
static void init_flashwindow(void)
{
HMODULE user32_module = LoadLibrary("USER32.DLL");
- if (user32_module) {
- p_FlashWindowEx = (p_FlashWindowEx_t)
- GetProcAddress(user32_module, "FlashWindowEx");
- }
+ GET_WINDOWS_FUNCTION(user32_module, FlashWindowEx);
}
static BOOL flash_window_ex(DWORD dwFlags, UINT uCount, DWORD dwTimeout)
static char *help_path;
static int help_has_contents;
#ifndef NO_HTMLHELP
-typedef HWND (CALLBACK *htmlhelp_t)(HWND, LPCSTR, UINT, DWORD);
+DECL_WINDOWS_FUNCTION(static, HWND, HtmlHelpA, (HWND, LPCSTR, UINT, DWORD));
static char *chm_path;
-static htmlhelp_t htmlhelp;
#endif /* NO_HTMLHELP */
void init_help(void)
chm_path = NULL;
if (chm_path) {
HINSTANCE dllHH = LoadLibrary("hhctrl.ocx");
- if (dllHH) {
- htmlhelp = (htmlhelp_t)GetProcAddress(dllHH, "HtmlHelpA");
- if (!htmlhelp)
+ GET_WINDOWS_FUNCTION(dllHH, HtmlHelpA);
+ if (!p_HtmlHelpA) {
+ chm_path = NULL;
+ if (dllHH)
FreeLibrary(dllHH);
}
- if (!htmlhelp)
- chm_path = NULL;
}
#endif /* NO_HTMLHELP */
}
assert(topic[colonpos] != '\0');
fname = dupprintf("%s::/%s.html>main", chm_path,
topic + colonpos + 1);
- htmlhelp(hwnd, fname, HH_DISPLAY_TOPIC, 0);
+ p_HtmlHelpA(hwnd, fname, HH_DISPLAY_TOPIC, 0);
sfree(fname);
} else
#endif /* NO_HTMLHELP */
} else {
#ifndef NO_HTMLHELP
if (chm_path) {
- htmlhelp(hwnd, chm_path, HH_DISPLAY_TOPIC, 0);
+ p_HtmlHelpA(hwnd, chm_path, HH_DISPLAY_TOPIC, 0);
} else
#endif /* NO_HTMLHELP */
if (help_path) {
if (requested_help) {
#ifndef NO_HTMLHELP
if (chm_path) {
- htmlhelp(NULL, NULL, HH_CLOSE_ALL, 0);
+ p_HtmlHelpA(NULL, NULL, HH_CLOSE_ALL, 0);
} else
#endif /* NO_HTMLHELP */
if (help_path) {
static int has_security;
#ifndef NO_SECURITY
-typedef DWORD(WINAPI * gsi_fn_t)
- (HANDLE, SE_OBJECT_TYPE, SECURITY_INFORMATION,
- PSID *, PSID *, PACL *, PACL *, PSECURITY_DESCRIPTOR *);
-static gsi_fn_t getsecurityinfo;
+DECL_WINDOWS_FUNCTION(static, DWORD, GetSecurityInfo,
+ (HANDLE, SE_OBJECT_TYPE, SECURITY_INFORMATION,
+ PSID *, PSID *, PACL *, PACL *,
+ PSECURITY_DESCRIPTOR *));
#endif
/*
#endif
return 0;
}
- if (getsecurityinfo(proc, SE_KERNEL_OBJECT,
- OWNER_SECURITY_INFORMATION,
- &procowner, NULL, NULL, NULL,
- &psd2) != ERROR_SUCCESS) {
+ if (p_GetSecurityInfo(proc, SE_KERNEL_OBJECT,
+ OWNER_SECURITY_INFORMATION,
+ &procowner, NULL, NULL, NULL,
+ &psd2) != ERROR_SUCCESS) {
#ifdef DEBUG_IPC
debug(("couldn't get owner info for process\n"));
#endif
return 0; /* unable to get security info */
}
CloseHandle(proc);
- if ((rc = getsecurityinfo(filemap, SE_KERNEL_OBJECT,
- OWNER_SECURITY_INFORMATION,
- &mapowner, NULL, NULL, NULL,
- &psd1) != ERROR_SUCCESS)) {
+ if ((rc = p_GetSecurityInfo(filemap, SE_KERNEL_OBJECT,
+ OWNER_SECURITY_INFORMATION,
+ &mapowner, NULL, NULL, NULL,
+ &psd1) != ERROR_SUCCESS)) {
#ifdef DEBUG_IPC
debug(
("couldn't get owner info for filemap: %d\n",
* Attempt to get the security API we need.
*/
advapi = LoadLibrary("ADVAPI32.DLL");
- getsecurityinfo =
- (gsi_fn_t) GetProcAddress(advapi, "GetSecurityInfo");
- if (!getsecurityinfo) {
+ GET_WINDOWS_FUNCTION(advapi, GetSecurityInfo);
+ if (!p_GetSecurityInfo) {
MessageBox(NULL,
"Unable to access security APIs. Pageant will\n"
"not run, in case it causes a security breach.",
static int tried_shgetfolderpath = FALSE;
static HMODULE shell32_module = NULL;
-typedef HRESULT (WINAPI *p_SHGetFolderPath_t)
- (HWND, int, HANDLE, DWORD, LPTSTR);
-static p_SHGetFolderPath_t p_SHGetFolderPath = NULL;
+DECL_WINDOWS_FUNCTION(static, HRESULT, SHGetFolderPathA,
+ (HWND, int, HANDLE, DWORD, LPSTR));
static void mungestr(const char *in, char *out)
{
* However, the invocation below requires IE5+ anyway,
* so stuff that. */
shell32_module = LoadLibrary("SHELL32.DLL");
- if (shell32_module) {
- p_SHGetFolderPath = (p_SHGetFolderPath_t)
- GetProcAddress(shell32_module, "SHGetFolderPathA");
- }
+ GET_WINDOWS_FUNCTION(shell32_module, SHGetFolderPathA);
}
- if (p_SHGetFolderPath) {
- if (SUCCEEDED(p_SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA,
- NULL, SHGFP_TYPE_CURRENT, seedpath))) {
+ if (p_SHGetFolderPathA) {
+ if (SUCCEEDED(p_SHGetFolderPathA(NULL, CSIDL_LOCAL_APPDATA,
+ NULL, SHGFP_TYPE_CURRENT, seedpath))) {
strcat(seedpath, "\\PUTTY.RND");
if (try_random_seed(seedpath, action, &rethandle))
return rethandle;
}
- if (SUCCEEDED(p_SHGetFolderPath(NULL, CSIDL_APPDATA,
- NULL, SHGFP_TYPE_CURRENT, seedpath))) {
+ if (SUCCEEDED(p_SHGetFolderPathA(NULL, CSIDL_APPDATA,
+ NULL, SHGFP_TYPE_CURRENT, seedpath))) {
strcat(seedpath, "\\PUTTY.RND");
if (try_random_seed(seedpath, action, &rethandle))
return rethandle;