MCPcopy Create free account
hub / github.com/JHRobotics/softgpu / registrySplitPath

Function registrySplitPath

winreg.c:65–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63static char winreg_tmp[REG_PATH_MAX];
64
65static BOOL registrySplitPath(const char *path, HKEY *rootkey, const char **key, const char **subkey)
66{
67 const char *p1 = strchr(path, '\\');
68 const char *p2 = strrchr(path, '\\');
69
70 size_t p1_len = p1 - path;
71 size_t p2_len = 0;
72 size_t p3_len = strlen(p2+1);
73
74 if(p2 - p1 > 0)
75 {
76 p2_len = p2 - p1 - 1;
77 }
78
79 if(p1_len == 0)
80 {
81 return FALSE;
82 }
83
84 memcpy(winreg_tmp, path, p1_len);
85 winreg_tmp[p1_len] = '\0';
86
87 for(const rootkey_t *rk = &rootkeys[0]; rk->name != NULL; rk++)
88 {
89 if(stricmp(rk->name, winreg_tmp) == 0)
90 {
91 *rootkey = rk->key;
92 if(p2_len > 0)
93 {
94 memcpy(winreg_tmp, p1+1, p2_len);
95 winreg_tmp[p2_len] = '\0';
96 *key = &(winreg_tmp[0]);
97 }
98 else
99 {
100 *key = NULL;
101 }
102
103 if(p3_len > 0)
104 {
105 *subkey = p2+1;
106 }
107 else
108 {
109 *subkey = NULL;
110 }
111
112 return TRUE;
113 }
114 }
115
116 return FALSE;
117}
118
119BOOL registryRead(const char *path, char *buffer, size_t buffer_size)
120{

Callers 6

registryReadFunction · 0.85
registryWriteFunction · 0.85
registryDeleteFunction · 0.85
registryWriteInfFunction · 0.85
registryDeleteInfFunction · 0.85
registryDeleteKeyInfFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected