5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews/*
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * checkdll.c - Winsock DLL/IDN processing status
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews */
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews/*
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * Copyright (c) 2000,2002 Japan Network Information Center.
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * All rights reserved.
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews *
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * By using this file, you agree to the terms and conditions set forth bellow.
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews *
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * LICENSE TERMS AND CONDITIONS
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews *
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * The following License Terms and Conditions apply, unless a different
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * license is obtained from Japan Network Information Center ("JPNIC"),
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * Chiyoda-ku, Tokyo 101-0047, Japan.
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews *
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * 1. Use, Modification and Redistribution (including distribution of any
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * modified or derived work) in source and/or binary forms is permitted
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * under this License Terms and Conditions.
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews *
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * 2. Redistribution of source code must retain the copyright notices as they
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * appear in each source code file, this License Terms and Conditions.
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews *
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * 3. Redistribution in binary form must reproduce the Copyright Notice,
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * this License Terms and Conditions, in the documentation and/or other
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * materials provided with the distribution. For the purposes of binary
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * distribution the "Copyright Notice" refers to the following language:
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews *
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * 4. The name of JPNIC may not be used to endorse or promote products
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * derived from this Software without specific prior written approval of
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * JPNIC.
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews *
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews */
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews#include <windows.h>
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews#include <stdio.h>
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews#include <stdlib.h>
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews#include <string.h>
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews#include "wrapcommon.h"
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsstatic int winsock_idx; /* index of winsock_info[] */
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsstatic struct winsock_type {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews char *version; /* winsock version */
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews char *name; /* wrapper DLL name */
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews char *original_name; /* original DLL name */
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews} winsock_info[] = {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews#define IDN_IDX_WS11 0
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews { "1.1", "WSOCK32", "WSOCK32O" },
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews#define IDN_IDX_WS20 1
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews { "2.0", "WS2_32", "WS2_32O" },
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews { NULL, NULL, NULL },
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews};
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsstatic HINSTANCE load_original_dll(void);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsstatic BOOL check_idn_processing(void);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsstatic BOOL check_dll(const char *name);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark AndrewsBOOL
5c526acb82c882e41b655c31f5fa4425c87b671cMark AndrewsidnWinsockVersion(const char *version) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews int i;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews for (i = 0; winsock_info[i].version != NULL; i++) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews if (strcmp(winsock_info[i].version, version) == 0) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews winsock_idx = i;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews idnLogPrintf(idn_log_level_trace,
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews "idnWinsockVersion: version %s\n",
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews version);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (TRUE);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews }
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews }
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews idnLogPrintf(idn_log_level_fatal,
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews "idnWinsockVersion: unknown winsock version %s\n",
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews version);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (FALSE);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews}
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark AndrewsHINSTANCE
5c526acb82c882e41b655c31f5fa4425c87b671cMark AndrewsidnWinsockHandle(void) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews static HINSTANCE dll_handle = NULL;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews static int initialized = 0;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews if (!initialized) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews /* Get the handle of the original winsock DLL */
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews idnLogPrintf(idn_log_level_trace,
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews "idnWinsockHandle: loading original DLL..\n");
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews dll_handle = load_original_dll();
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews }
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews initialized = 1;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (dll_handle);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews}
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsidn_resconf_t
5c526acb82c882e41b655c31f5fa4425c87b671cMark AndrewsidnGetContext(void) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews static int initialized = 0;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews static idn_resconf_t ctx = NULL;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews if (!initialized) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews /*
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * Check whether IDN processing should be done
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * in this wrapper DLL.
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews */
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews idnLogPrintf(idn_log_level_trace,
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews "idnGetContext: checking IDN status..\n");
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews if (check_idn_processing()) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews /* Initialize idnkit */
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews ctx = idnConvInit();
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews idnLogPrintf(idn_log_level_info,
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews "Processing context: %08x\n", ctx);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews } else {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews idnLogPrintf(idn_log_level_info,
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews "NOT process IDN here\n");
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews ctx = NULL;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews }
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews initialized = 1;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews }
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (ctx);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews}
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsstatic HINSTANCE
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsload_original_dll(void) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews /*
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * Load Original DLL
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews */
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews char dllpath[MAX_PATH];
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews const char *dll_name = winsock_info[winsock_idx].original_name;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews HINSTANCE handle;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews /*
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * Get idn wrapper's install directory, where the copies of
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * the original winsock DLLs are saved.
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews */
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews dllpath[0] = '\0';
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews if (idnGetInstallDir(dllpath, sizeof(dllpath)) != TRUE) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews idnLogPrintf(idn_log_level_fatal,
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews "idnWinsockHandle: cannot find idn wrapper's "
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews "install directory\n");
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews abort();
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (NULL); /* for lint */
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews }
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews /* Strip the trailing backslash. */
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews if (dllpath[0] != '\0' &&
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews dllpath[strlen(dllpath) - 1] == '\\') {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews dllpath[strlen(dllpath) - 1] = '\0';
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews }
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews /* Is the pathname is insanely long? */
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews if (strlen(dllpath) + strlen(dll_name) + 1 + 4 >= sizeof(dllpath)) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews idnLogPrintf(idn_log_level_fatal,
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews "idnWinsockHandle: idn wrapper's install path is "
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews "too long to be true\n");
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews abort();
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (NULL); /* for lint */
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews }
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews /* Append the DLL name to form a full pathname of the DLL. */
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews strcat(dllpath, "\\");
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews strcat(dllpath, dll_name);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews strcat(dllpath, ".DLL");
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews idnLogPrintf(idn_log_level_trace,
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews "idnWinsockHandle: loading original winsock DLL (%s)\n",
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews dllpath);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews if ((handle = LoadLibrary(dllpath)) == NULL) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews idnLogPrintf(idn_log_level_fatal,
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews "idnWinsockHandle: no DLL %-.100s\n", dllpath);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews abort();
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (NULL); /* font lint */
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews }
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (handle);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews}
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsstatic BOOL
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewscheck_idn_processing(void) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews int where = idnEncodeWhere();
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews BOOL here = FALSE;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews idnLogPrintf(idn_log_level_trace,
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews "idnGetContext: Winsock%s, where=%d\n",
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews winsock_info[winsock_idx].version, where);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews switch (winsock_idx) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews case IDN_IDX_WS11:
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews switch (where) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews case IDN_ENCODE_ALWAYS:
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews case IDN_ENCODE_ONLY11:
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (TRUE);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews case IDN_ENCODE_CHECK:
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews if (!check_dll(winsock_info[winsock_idx].name)) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (TRUE);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews }
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews break;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews }
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews break;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews case IDN_IDX_WS20:
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews switch (where) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews case IDN_ENCODE_ALWAYS:
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews case IDN_ENCODE_ONLY20:
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews case IDN_ENCODE_CHECK:
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (TRUE);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews break;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews }
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews break;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews }
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (FALSE);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews}
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsstatic BOOL
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewscheck_dll(const char *name) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews HINSTANCE hdll = NULL;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews#if 1
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews hdll = LoadLibrary(name);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews#else
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews /*
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * Just check the existence of the named DLL, without taking
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * the trouble of calling DllMain.
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews */
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews hdll = LoadLibraryEx(name, NULL, LOAD_LIBRARY_AS_DATAFILE);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews#endif
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews if (hdll == NULL) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews idnLogPrintf(idn_log_level_trace,
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews "idnGetContext: DLL %s does not exist\n");
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (FALSE);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews } else {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews idnLogPrintf(idn_log_level_trace,
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews "idnGetContext: DLL %s exists\n");
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews FreeLibrary(hdll);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (TRUE);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews }
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews}