MCPcopy Create free account
hub / github.com/bobranten/Ext4Fsd / Ext2SetAppAutorunVista

Function Ext2SetAppAutorunVista

Ext2Mgr/enumDisk.cpp:5194–5269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5192}
5193
5194BOOL
5195Ext2SetAppAutorunVista(BOOL bAutorun)
5196{
5197 CHAR *userList = NULL, *user, *e;
5198 CHAR userName[256] = {0};
5199 DWORD userLen = 255;
5200 BOOL changed = FALSE;
5201
5202 if (!GetUserName(userName, &userLen))
5203 return FALSE;
5204
5205 userList = Ext2QueryAutoUserList();
5206 if (!userList)
5207 return FALSE;
5208
5209 if (bAutorun) {
5210
5211 user = userList;
5212 while (user = Ext2StrStr(user, userName)) {
5213 if (user > userList) {
5214 e = user-1;
5215 if (*e != ',' && *e != ';') {
5216 user = user + strlen(userName);
5217 continue;
5218 }
5219 }
5220 e = &user[strlen(userName)];
5221 if (!*e || *e == ',' || *e == ';') {
5222 goto errorout;
5223 }
5224 user = user + strlen(userName);
5225 }
5226
5227 e = &userList[strlen(userList) - 1];
5228 if (e > userList && *e != ',' && *e != ';') {
5229 strcat_s(userList, PAGE_SIZE - 1, ";");
5230 }
5231 strcat_s(userList, PAGE_SIZE - 1, userName);
5232 strcat_s(userList, PAGE_SIZE - 1, ";");
5233 changed = TRUE;
5234
5235 } else {
5236 user = userList;
5237 while (user = Ext2StrStr(user, userName)) {
5238 if (user > userList) {
5239 e = user - 1;
5240 if (*e != ',' && *e != ';') {
5241 user = user + strlen(userName);
5242 continue;
5243 }
5244 }
5245 e = &user[strlen(userName)];
5246 if (!*e) {
5247 memset(user, 0, strlen(userName) + 1);
5248 changed = TRUE;
5249 } else if (*e == ',' || *e == ';') {
5250 memmove(user, e + 1, strlen(e));
5251 changed = TRUE;

Callers 1

Ext2SetAppAutorunFunction · 0.85

Calls 3

Ext2SetAutoRunUserListFunction · 0.85
Ext2QueryAutoUserListFunction · 0.70
Ext2StrStrFunction · 0.70

Tested by

no test coverage detected