void joy95_get_name(int joyid, char *name, int namesize) { JOYCAPS jc; MMRESULT res; //HKEY hkey; //long lres; char regpath[256]; registry_handle *rhandle; char reglabel[32]; name[0] = 0; switch(SpecialDevice) { case TACTILE_IMMERSION: strcpy(name, "I-Force Force-Feedback"); return; } res = joyGetDevCaps(joyid, &jc, sizeof(jc)); if (res != JOYERR_NOERROR) { strcpy(name, "NO JOYSTICK DETECTED"); return; } // we have the reg key! registry_setpath(HKEY_LOCAL_MACHINE); strcpy(regpath, "System\\CurrentControlSet\\control\\MediaResources\\joystick\\"); strcat(regpath, jc.szRegKey); strcat(regpath, "\\CurrentJoystickSettings"); sprintf(reglabel, "Joystick%dOEMName", joyid+1); if ((rhandle = registry_open(regpath))) { if (!registry_getstring(rhandle, reglabel, name, namesize)) { registry_close(rhandle); strcpy(name, "JOYSTICK"); return; } registry_close(rhandle); // have reg entry for full name strcpy(regpath, "System\\CurrentControlSet\\control\\MediaProperties\\PrivateProperties\\Joystick\\OEM\\"); strcat(regpath, name); if ((rhandle = registry_open(regpath))) { if (!registry_getstring(rhandle, "OEMName", name, namesize)) { registry_close(rhandle); strcpy(name, "JOYSTICK"); return; } registry_close(rhandle); } else strcpy(name, "JOYSTICK"); } else strcpy(name, "JOYSTICK"); }
void registry_free(rdpRegistry* registry) { if (registry != NULL) { registry_close(registry); xfree(registry->path); xfree(registry->file); xfree(registry->home); xfree(registry); } }
int registry_keyval_delete(HKEY hkey, char *base, char *sub) { HKEY k; int err; k = registry_open(hkey, base, KEY_WRITE); if (k == INVALID_HANDLE_VALUE) return -1; err = registry_value_delete(k, sub); registry_close(k); return err; }
int registry_keyval_string_set(HKEY hkey, char *base, char *sub, char *val) { HKEY k; int err; k = registry_open(hkey, base, KEY_WRITE); if (k == INVALID_HANDLE_VALUE) return -1; err = registry_string_set(k, sub, val); registry_close(k); return err; }
int registry_keyval_dword_get(HKEY hkey, char *base, char *sub, DWORD *val) { HKEY k; int err; k = registry_open(hkey, base, KEY_READ); if (k == INVALID_HANDLE_VALUE) return -1; err = registry_dword_get(k, sub, val); registry_close(k); return err; }
int registry_keyval_string_get(HKEY hkey, char *base, char *sub, char **val) { HKEY k; int err; k = registry_open(hkey, base, KEY_READ); if (k == INVALID_HANDLE_VALUE) { *val = NULL; return -1; } err = registry_string_get(k, sub, val); registry_close(k); return err; }