Пример #1
0
int
get_iis_script_dir(char *dir)
{
	*dir = 0;

	if (get_iis_script_dir_from_metabase(dir)) {
		return 1;
	}

	HKEY hKeyRoot = reg_lookup(HKEY_LOCAL_MACHINE, TEXT(IIS_ROOTS));
	if (! hKeyRoot) {
		strcpy(dir, "");
		return 0;
	}

	if (reg_query_string(hKeyRoot, TEXT("/SCRIPTS"), dir))
		return 1;

	if (reg_query_string(hKeyRoot, TEXT("/"), dir))
		return 1;

	strcpy(dir, "unknown");

	return 1;
}
Пример #2
0
static char *
add_resin_filter_registry(HWND hDlg, char *filter_path)
{
	char buf[1024];
	HKEY hKeyParams;
	
	buf[0] = 0;
	if (! (hKeyParams = reg_lookup(HKEY_LOCAL_MACHINE, IIS_PARAM)))
		return "Can't open IIS Parameters";

	reg_query_string(hKeyParams, TEXT("Filter DLLs"), buf);

	RegCloseKey(hKeyParams);

	if (strstr("isapi_srun.dll", buf))
		return 0;

	if (buf[0])
		strcat(buf, ",");

	strcat(buf, "isapi_srun.dll");

	reg_set_string(IIS_PARAM, "Filter DLLs", buf);


	return 0;
}
Пример #3
0
static int
get_apache_registry(char *home, int size)
{
	HKEY hKeyApache;
	char version[MAX_PATH + 1];
	char bestVersion[1024];
	int index = 0;
	HKEY hKeyVersion = 0;
	
	if (! (hKeyApache = reg_lookup(HKEY_LOCAL_MACHINE, HKEY_APACHE)))
		return 0;

	bestVersion[0] = 0;
	while ((RegEnumKey(hKeyApache, index++, version, sizeof(version))) == ERROR_SUCCESS) {
		if (strcmp(version, bestVersion) > 0)
			strcpy(bestVersion, version);
	}

	if (! (hKeyVersion = reg_lookup(hKeyApache, bestVersion)))
		return 0;

	if (! reg_query_string(hKeyVersion, HKEY_APACHE_HOME, home))
		return 0;

	return 1;
}
Пример #4
0
BOOL win_association_exists(const struct win_association_info *assoc)
{
	BOOL rc = FALSE;
	TCHAR buf[1024];
	TCHAR expected[1024];
	HKEY key1 = NULL;
	HKEY key2 = NULL;

	// first check to see if the extension is there at all
	if (RegOpenKey(HKEY_CLASSES_ROOT, A2T(assoc->file_class), &key1))
		goto done;

	if (RegOpenKey(key1, TEXT("shell\\open\\command"), &key2))
		goto done;

	if (reg_query_string(key2, buf, sizeof(buf) / sizeof(buf[0])))
		goto done;

	get_open_command(assoc, expected, sizeof(expected) / sizeof(expected[0]));
	rc = !_tcscmp(expected, buf);

done:
	if (key2)
		RegCloseKey(key2);
	if (key1)
		RegCloseKey(key1);
	return rc;
}
Пример #5
0
static std::wstring improve_name_from_usb_path(const std::wstring &regpath)
{
	static const std::wstring usbbasepath(L"SYSTEM\\CurrentControlSet\\Enum\\USB");

	// extract the expected parent ID from the regpath
	size_t last_slash_index = regpath.find_last_of('\\');
	if (last_slash_index == std::wstring::npos)
		return std::wstring();

	std::wstring parentid = regpath.substr(last_slash_index + 1);

	// open the USB key
	auto usb_key = reg_open_key(HKEY_LOCAL_MACHINE, usbbasepath);
	if (!usb_key.valid())
		return std::wstring();

	std::wstring regstring;

	foreach_subkey(usb_key, [&regstring, &parentid](HKEY subkey)
	{
		foreach_subkey(subkey, [&regstring, &parentid](HKEY endkey)
		{
			std::wstring endparentid = reg_query_string(endkey, L"ParentIdPrefix");

			// This key doesn't have a ParentIdPrefix
			if (endparentid.empty())
				return true;

			// do we have a match?
			if (parentid.find(endparentid) == 0)
				regstring = reg_query_string(endkey, L"DeviceDesc");

			return regstring.empty();
		});

		return regstring.empty();
	});

	return trim_prefix(regstring);
}
char *
get_website_home()
{
    char buf[1024];
    HKEY hKeyRoot;

    hKeyRoot = reg_lookup(HKEY_LOCAL_MACHINE, ROOT_KEY);
    if(hKeyRoot == 0)
        return 0;
    if(reg_query_string(hKeyRoot, "ServerRoot", buf) == 0)
        return 0;
    RegCloseKey(hKeyRoot);
    return strdup(buf);
}
Пример #7
0
static std::wstring improve_name_from_base_path(const std::wstring &regpath, bool *hid)
{
	// now try to open the registry key
	auto device_key = reg_open_key(HKEY_LOCAL_MACHINE, regpath);
	if (!device_key.valid())
		return std::wstring();

	// fetch the device description; if it exists, we are finished
	auto regstring = reg_query_string(device_key, L"DeviceDesc");
	if (!regstring.empty())
		return trim_prefix(regstring);

	// if the key name does not contain "HID", it's not going to be in the USB tree; give up
	*hid = regpath.find(L"HID") != std::string::npos;
	return std::wstring();
}
Пример #8
0
BOOL win_is_extension_associated(const struct win_association_info *assoc,
	const char *extension)
{
	HKEY key = NULL;
	TCHAR buf[256];
	BOOL rc = FALSE;

	// first check to see if the extension is there at all
	if (!win_association_exists(assoc))
		goto done;

	if (RegOpenKey(HKEY_CLASSES_ROOT, A2T(extension), &key))
		goto done;

	if (reg_query_string(key, buf, sizeof(buf) / sizeof(buf[0])))
		goto done;

	rc = !_tcscmp(buf, assoc->file_class);

done:
	if (key)
		RegCloseKey(key);
	return rc;
}
Пример #9
0
static TCHAR *rawinput_device_improve_name(TCHAR *name)
{
	static const TCHAR usbbasepath[] = TEXT("SYSTEM\\CurrentControlSet\\Enum\\USB");
	static const TCHAR basepath[] = TEXT("SYSTEM\\CurrentControlSet\\Enum\\");
	TCHAR *regstring = NULL;
	TCHAR *parentid = NULL;
	TCHAR *regpath = NULL;
	const TCHAR *chsrc;
	HKEY regkey = NULL;
	int usbindex;
	TCHAR *chdst;
	LONG result;

	// The RAW name received is formatted as:
	//   \??\type-id#hardware-id#instance-id#{DeviceClasses-id}
	// XP starts with "\??\"
	// Vista64 starts with "\\?\"

	// ensure the name is something we can handle
	if (_tcsncmp(name, TEXT("\\\\?\\"), 4) != 0 && _tcsncmp(name, TEXT("\\??\\"), 4) != 0)
		return name;

	// allocate a temporary string and concatenate the base path plus the name
	regpath = global_alloc_array(TCHAR, _tcslen(basepath) + 1 + _tcslen(name));
	_tcscpy(regpath, basepath);
	chdst = regpath + _tcslen(regpath);

	// convert all # to \ in the name
	for (chsrc = name + 4; *chsrc != 0; chsrc++)
		*chdst++ = (*chsrc == '#') ? '\\' : *chsrc;
	*chdst = 0;

	// remove the final chunk
	chdst = _tcsrchr(regpath, '\\');
	if (chdst == NULL)
		goto exit;
	*chdst = 0;

	// now try to open the registry key
	result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, regpath, 0, KEY_READ, &regkey);
	if (result != ERROR_SUCCESS)
		goto exit;

	// fetch the device description; if it exists, we are finished
	regstring = reg_query_string(regkey, TEXT("DeviceDesc"));
	if (regstring != NULL)
		goto convert;

	// close this key
	RegCloseKey(regkey);
	regkey = NULL;

	// if the key name does not contain "HID", it's not going to be in the USB tree; give up
	if (_tcsstr(regpath, TEXT("HID")) == NULL)
		goto exit;

	// extract the expected parent ID from the regpath
	parentid = _tcsrchr(regpath, '\\');
	if (parentid == NULL)
		goto exit;
	parentid++;

	// open the USB key
	result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, usbbasepath, 0, KEY_READ, &regkey);
	if (result != ERROR_SUCCESS)
		goto exit;

	// enumerate the USB key
	for (usbindex = 0; result == ERROR_SUCCESS && regstring == NULL; usbindex++)
	{
		TCHAR keyname[MAX_PATH];
		DWORD namelen;

		// get the next enumerated subkey and scan it
		namelen = ARRAY_LENGTH(keyname) - 1;
		result = RegEnumKeyEx(regkey, usbindex, keyname, &namelen, NULL, NULL, NULL, NULL);
		if (result == ERROR_SUCCESS)
		{
			LONG subresult;
			int subindex;
			HKEY subkey;

			// open the subkey
			subresult = RegOpenKeyEx(regkey, keyname, 0, KEY_READ, &subkey);
			if (subresult != ERROR_SUCCESS)
				continue;

			// enumerate the subkey
			for (subindex = 0; subresult == ERROR_SUCCESS && regstring == NULL; subindex++)
			{
				// get the next enumerated subkey and scan it
				namelen = ARRAY_LENGTH(keyname) - 1;
				subresult = RegEnumKeyEx(subkey, subindex, keyname, &namelen, NULL, NULL, NULL, NULL);
				if (subresult == ERROR_SUCCESS)
				{
					TCHAR *endparentid;
					LONG endresult;
					HKEY endkey;

					// open this final key
					endresult = RegOpenKeyEx(subkey, keyname, 0, KEY_READ, &endkey);
					if (endresult != ERROR_SUCCESS)
						continue;

					// do we have a match?
					endparentid = reg_query_string(endkey, TEXT("ParentIdPrefix"));
					if (endparentid != NULL && _tcsncmp(parentid, endparentid, _tcslen(endparentid)) == 0)
						regstring = reg_query_string(endkey, TEXT("DeviceDesc"));

					// free memory and close the key
					if (endparentid != NULL)
						global_free_array(endparentid);
					RegCloseKey(endkey);
				}
			}

			// close the subkey
			RegCloseKey(subkey);
		}
	}

	// if we didn't find anything, go to the exit
	if (regstring == NULL)
		goto exit;

convert:
	// replace the name with the nicer one
	global_free_array(name);

	// remove anything prior to the final semicolon
	chsrc = _tcsrchr(regstring, ';');
	if (chsrc != NULL)
		chsrc++;
	else
		chsrc = regstring;
	name = global_alloc_array(TCHAR, _tcslen(chsrc) + 1);
	_tcscpy(name, chsrc);

exit:
	if (regstring != NULL)
		global_free_array(regstring);
	if (regpath != NULL)
		global_free_array(regpath);
	if (regkey != NULL)
		RegCloseKey(regkey);

	return name;
}
Пример #10
0
static int GetCustomVideoModes(ConfigSettings *cs, ModeLine VideoMode[MAX_MODELINES]) {
    HKEY hKey;
    int dwIndex = 0, j = -1;
    int  hactive, vactive, vfreq;
    LONG lRes;
    TCHAR dv[1024];
    TCHAR *DefaultVideo = NULL;
    DWORD type;

    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("HARDWARE\\DEVICEMAP\\VIDEO"), 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS) {
        TCHAR *chsrc, *chdst;

        DefaultVideo = reg_query_string(hKey, TEXT("\\Device\\Video0"));
        RegCloseKey(hKey);

        if (DefaultVideo == NULL) {
            mame_printf_error("SwitchRes: Failed opening \\Device\\Video0 registry\n");
            return -1;
        }

        chdst = dv;

        for (chsrc = DefaultVideo + 18; *chsrc != 0; chsrc++)
            *chdst++ = *chsrc;
        *chdst = 0;
    } else {
        mame_printf_error("SwitchRes: Failed opening DefaultVideo registry\n");
        return -1;
    }

    if (cs->verbose)
        mame_printf_verbose("SwitchRes: DefaultVideo '%s'\n", utf8_from_tstring(dv));

    if ((lRes = RegOpenKeyEx(HKEY_LOCAL_MACHINE, dv, 0, KEY_ALL_ACCESS, &hKey)) == ERROR_SUCCESS) {
        type = 0;
        TCHAR lpValueName[1024];
        char lpData[1024];
        DWORD lpcValueName = 1024;
        DWORD lpcData = 1024;

        while (RegEnumValue (hKey, dwIndex, lpValueName, &lpcValueName, NULL, &type, (LPBYTE)lpData, &lpcData) != ERROR_NO_MORE_ITEMS) {
            dwIndex++;

            if (_tcsstr(lpValueName, TEXT("DALDTMCRTBCD"))) {
                int hhh = 0, hhi = 0, hhf = 0, hht = 0, vvv = 0, vvi = 0, vvf = 0, vvt = 0, interlace = 0;
                double dotclock = 0;
                int checksum;
                int i = 0, k = 0;
                int active = 0;

                if (cs->verbose)
                    mame_printf_verbose("SwitchRes: %s:\n ", utf8_from_tstring(lpValueName));

                dotclock = (double)CustomModeDataWord(38, lpData);
                hhh = (int)RealRes(CustomModeDataWord(10, lpData));
                hhi = (int)RealRes(CustomModeDataWord(14, lpData));
                hhf = (int)RealRes(CustomModeDataWord(18, lpData)) + hhi;
                hht = (int)RealRes(CustomModeDataWord(6, lpData));
                vvv = CustomModeDataWord(26, lpData);
                vvi = CustomModeDataWord(30, lpData);
                vvf = CustomModeDataWord(34, lpData) + vvi;
                vvt = CustomModeDataWord(22, lpData);
                interlace = (lpData[3] == 0x0e)?1:0;

                checksum = CustomModeDataWordBCD(66, lpData);

                if (cs->verbose)
                    mame_printf_verbose("SwitchRes: (%d/%d) Modeline %.6f %d %d %d %d %d %d %d %d%s\n",
                                        checksum, (int)lpcData, (double)((double)dotclock * 10000.0)/1000000.0,
                                        (int)RealRes (hhh), (int)RealRes (hhi), (int)RealRes (hhf), (int)RealRes (hht),
                                        vvv, vvi, vvf, vvt, (interlace)?" interlace":"");

                if (sscanf(utf8_from_tstring(lpValueName), "DALDTMCRTBCD%dx%dx0x%d", &hactive, &vactive, &vfreq) != 3) {
                    if (sscanf(utf8_from_tstring(lpValueName), "DALDTMCRTBCD%dX%dX0X%d", &hactive, &vactive, &vfreq) != 3) {
                        mame_printf_info("SwitchRes: Failed getting resolution values from %s\n", utf8_from_tstring(lpValueName));
                        continue;
                    }
                }

                for (k = 0; k < MAX_MODELINES; k++) {
                    if (VideoMode[k].hactive == hactive &&
                            VideoMode[k].vactive == vactive &&
                            VideoMode[k].vfreq == vfreq)
                    {
                        active = 1;
                        break;
                    }
                }

                if (active) {
                    sprintf(VideoMode[k].name, "%dx%d@%d", hactive, vactive, vfreq);

                    VideoMode[k].a_width = hactive;
                    VideoMode[k].a_height = vactive;

                    sprintf(VideoMode[k].resolution, "%dx%d@%d", hactive, vactive, vfreq);
                    VideoMode[k].vfreq = vfreq;
                    VideoMode[k].a_vfreq = (double)(dotclock * 10000.0) / (vvt * hht);
                    VideoMode[k].pclock  = dotclock * 10000;
                    VideoMode[k].hactive = hhh;
                    VideoMode[k].hbegin  = hhi;
                    VideoMode[k].hend    = hhf;
                    VideoMode[k].htotal  = hht;
                    VideoMode[k].vactive = vvv;
                    VideoMode[k].vbegin  = vvi;
                    VideoMode[k].vend    = vvf;
                    VideoMode[k].vtotal  = vvt;
                    VideoMode[k].interlace  = interlace;
                    VideoMode[k].doublescan  = 0;
                    VideoMode[k].custom  = 1;

                    for(i=0; i < lpcValueName; i++) {
                        VideoMode[k].label[i] = lpValueName[i];
                    }
                    VideoMode[k].regdata_size = lpcData;

                    for(i=0; i < VideoMode[k].regdata_size; i++) {
                        VideoMode[k].regdata[i] = lpData[i];
                        if (cs->verbose > 4)
                            mame_printf_verbose("[%02X]", lpData[i]);
                    }
                    if (cs->verbose > 4)
                        mame_printf_verbose("\n");

                    j++;
                }
            }

            lpcValueName = 1024;
            lpcData = 1024;
        }

        RegCloseKey(hKey);
    } else {
        mame_printf_error("SwitchRes: Failed opening %s registry entry with error %d\n", utf8_from_tstring(dv), (int)lRes);
        j = -1;
    }

    if (DefaultVideo != NULL)
        global_free(DefaultVideo);

    return j;
}
Пример #11
0
static int SetCustomVideoModes(ConfigSettings *cs, ModeLine *VideoMode, ModeLine *mode, int reset) {
    HKEY hKey;
    LONG lRes;
    TCHAR	dv[1024];
    TCHAR *DefaultVideo = NULL;
    DWORD type;
    char lpValueName[1024];
    char lpData[1024];
    int hhh = 0, hhi = 0, hhf = 0, hht = 0, vvv = 0, vvi = 0, vvf = 0, vvt = 0, interlace = 0;
    double dotclock = 0;
    long checksum;
    int old_checksum;
    int i;

    if (!strcmp(VideoMode->label, "") || !VideoMode->custom)
        return 0;
    if (reset && VideoMode->modified != 1) {
        mame_printf_error("SwitchRes: Error, the %s registry modeline was never modified!!!\n",
                          VideoMode->label);
        return -1;
    } else if (!reset && VideoMode->modified == 1) {
        mame_printf_error("SwitchRes: Error, the %s registry modeline has already been modified!!!\n",
                          VideoMode->label);
        return -1;
    }

    mame_printf_verbose("SwitchRes: %s modeline registry entry for %s\n",
                        reset?"Resetting":"Setting", VideoMode->label);

    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("HARDWARE\\DEVICEMAP\\VIDEO"), 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS) {
        TCHAR *chsrc, *chdst;

        DefaultVideo = reg_query_string(hKey, TEXT("\\Device\\Video0"));
        RegCloseKey(hKey);

        if (DefaultVideo == NULL)
            return -1;

        chdst = dv;
        for (chsrc = DefaultVideo + 18; *chsrc != 0; chsrc++)
            *chdst++ = *chsrc;
        *chdst = 0;
    } else {
        mame_printf_info("SwitchRes: Failed opening DefaultVideo registry\n");
        return -1;
    }

    sprintf(lpValueName, "%s", VideoMode->label);

    for(i=0; i < VideoMode->regdata_size; i++) {
        lpData[i] = VideoMode->regdata[i];
        if (cs->verbose > 4)
            mame_printf_verbose("[%02X]", lpData[i]);
    }
    if (cs->verbose > 4)
        mame_printf_verbose("\n");

    SetCustomModeDataWordBCD (lpData, (int)mode->pclock/10000, 38);
    SetCustomModeDataWordBCD (lpData, mode->hactive, 10);
    SetCustomModeDataWordBCD (lpData, mode->hbegin, 14);
    SetCustomModeDataWordBCD (lpData, mode->hend - mode->hbegin, 18);
    SetCustomModeDataWordBCD (lpData, mode->htotal, 6);
    SetCustomModeDataWordBCD (lpData, mode->vactive, 26);
    SetCustomModeDataWordBCD (lpData, mode->vbegin, 30);
    SetCustomModeDataWordBCD (lpData, mode->vend - mode->vbegin, 34);
    SetCustomModeDataWordBCD (lpData, mode->vtotal, 22);

    if (mode->interlace)
        lpData[3] = 0x0e;
    else
        lpData[3] = 0x0c;

    dotclock = (double)CustomModeDataWord(38, lpData);
    hhh = CustomModeDataWord(10, lpData);
    hhi = CustomModeDataWord(14, lpData);
    hhf = CustomModeDataWord(18, lpData) + hhi;
    hht = CustomModeDataWord(6, lpData);
    vvv = CustomModeDataWord(26, lpData);
    vvi = CustomModeDataWord(30, lpData);
    vvf = CustomModeDataWord(34, lpData) + vvi;
    vvt = CustomModeDataWord(22, lpData);
    interlace = (lpData[3] == 0x0e)?1:0;

    old_checksum = CustomModeDataWordBCD(66, lpData);

    checksum = 65535 - ((lpData[3] == 0x0e)?0x0e:0x0c) - hht - hhh - hhf - vvt - vvv - vvf - dotclock;

    SetCustomModeDataWord (lpData, checksum, 66);

    for(i=0; i < VideoMode->regdata_size; i++) {
        if (cs->verbose > 4)
            mame_printf_verbose("[%02X]", lpData[i]);
    }
    if (cs->verbose > 4)
        mame_printf_verbose("\n");

    if (cs->verbose) {
        mame_printf_verbose("SwitchRes: Set Registry mode %s with:\n", VideoMode->label);
        mame_printf_verbose("SwitchRes: (%d/%d/%ld) Modeline %.6f %d %d %d %d %d %d %d %d%s\n",
                            CustomModeDataWordBCD(66, lpData),
                            old_checksum, checksum,
                            (double)((double)dotclock * 10000.0)/1000000.0,
                            (int)RealRes (hhh), (int)RealRes (hhi),
                            (int)RealRes (hhf), (int)RealRes (hht),
                            vvv, vvi, vvf, vvt, (interlace)?" interlace":"");
    }

    if ((lRes = RegOpenKeyEx(HKEY_LOCAL_MACHINE, dv, 0, KEY_ALL_ACCESS, &hKey)) == ERROR_SUCCESS) {
        type = REG_BINARY;

        // Write registry entry here
        if (RegSetValueExA(hKey, lpValueName, 0, type, (LPBYTE)lpData, VideoMode->regdata_size) != ERROR_SUCCESS)
            mame_printf_info("SwitchRes: Failed saving registry entry for %s modeline\n", VideoMode->label);

        RegCloseKey(hKey);
    } else {
        mame_printf_info("SwitchRes: Failed opening %s registry entry with error %d\n", (char*)dv, (int)lRes);
    }

    if (DefaultVideo != NULL)
        global_free(DefaultVideo);
    if (reset)
        VideoMode->modified = 0;
    else
        VideoMode->modified = 1;
    return 0;
}
char *
configure_website(HWND hDlg, char *resin_home, char *website_home)
{
    char src_name[1024];
    char dst_name[1024];
    FILE *src_file;
    FILE *dst_file;
    HKEY hKey;
    char buf[1024];
    char *cp;
    int len;

    //
    // Copy the ISAPI DLL to WebSite's home directory
    //
    sprintf(src_name, "%s\\bin\\isapi_srun.dll", resin_home);
    sprintf(dst_name, "%s\\isapi_srun.dll", website_home);

    dst_file = fopen(dst_name, "w+b");
    if (! dst_file)
        return "You must stop WebSite for setup to install the Resin ISAPI connector.";

    src_file = fopen(src_name, "rb");
    if (! src_file) {
        fclose(dst_file);
        return "Can't open isapi_srun.dll in RESIN_HOME";
    }

    while ((len = fread(buf, 1, sizeof(buf), src_file)) > 0) {
        fwrite(buf, 1, len, dst_file);
    }

    fclose(src_file);
    fclose(dst_file);

    //
    // Create the associations and server-side content type so that
    // WebSite knows what to do with .jsp, .xml, and .xtp files.
    //
    hKey = reg_lookup(HKEY_LOCAL_MACHINE, ASSOC_KEY);
    if(hKey == 0)
        return "Can't find WebSite association data in registry";

    len = strlen(dst_name) + 1;
    RegSetValueEx(hKey, ".jsp", 0, REG_SZ, (CONST BYTE *)dst_name, len);
    RegSetValueEx(hKey, ".xml", 0, REG_SZ, (CONST BYTE *)dst_name, len);
    RegSetValueEx(hKey, ".xtp", 0, REG_SZ, (CONST BYTE *)dst_name, len);
    RegCloseKey(hKey);

    hKey = reg_lookup(HKEY_LOCAL_MACHINE, TYPE_KEY);
    if(hKey == 0)
        return "Can't find WebSite type data in registry";

    cp = "wwwserver/isapi";
    len = strlen(cp) + 1;
    RegSetValueEx(hKey, ".jsp", 0, REG_SZ, (CONST BYTE *)cp, len);
    RegSetValueEx(hKey, ".xml", 0, REG_SZ, (CONST BYTE *)cp, len);
    RegSetValueEx(hKey, ".xtp", 0, REG_SZ, (CONST BYTE *)cp, len);
    RegCloseKey(hKey);

    //
    // Add isapi_srun.dll to the LoadLibrary list (unless already there).
    //
    hKey = reg_lookup(HKEY_LOCAL_MACHINE, ROOT_KEY);
    if(hKey == 0)
        return "Can't find WebSite root data in registry";
    if(reg_query_string(hKey, "LoadLibrary", buf) == 0)
        return 0;
    if(strstr(buf, "isapi_srun.dll") == NULL)			// If not already appended
    {
        if(buf[0] != '\0')								// If existing LoadLibrary stuff
            strcat(buf, ";");							// Insert delimiter
        strcat(buf, dst_name);
        RegSetValueEx(hKey, "LoadLibrary", 0, REG_SZ, (CONST BYTE *)buf, (strlen(buf) + 1));
    }
    RegCloseKey(hKey);

    return 0;
}