MCPcopy Create free account
hub / github.com/LiteLoaderQQNT/QQNTFileVerifyPatch / Hk_CreateFileW

Function Hk_CreateFileW

HijackMethod_x86/dllmain.cpp:110–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110HANDLE WINAPI Hk_CreateFileW(
111 _In_ LPCWSTR lpFileName,
112 _In_ DWORD dwDesiredAccess,
113 _In_ DWORD dwShareMode,
114 _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
115 _In_ DWORD dwCreationDisposition,
116 _In_ DWORD dwFlagsAndAttributes,
117 _In_opt_ HANDLE hTemplateFile
118) {
119 if (wcsstr(lpFileName, L"\\resources\\app\\app_launcher\\index.js") != NULL && mulock1 != true && mulock2 != true&&OldQQ==true)
120 {
121
122 if (_taccess(L"PatchConfig.json", 0) != 0) {
123 if (!IsRunAsAdmin()) {
124 RestartAsAdmin();
125 exit(0);
126 }
127
128 nlohmann::json data;
129 data["LLPath"] = "NULL";
130 std::ofstream file("PatchConfig.json");
131 file << std::setw(4) << data << std::endl;
132 file.close();
133 SetFileALLAccessPrems(L"PatchConfig.json");
134
135 }
136 else
137 {
138 std::ifstream file("PatchConfig.json");
139 nlohmann::json j;
140 file >> j;
141 file.close();
142 std::string value = "";
143 if (j.find("LLPath") != j.end()) {
144 value = j["LLPath"];
145 }
146 else
147 {
148 MessageBoxA(nullptr, "Cant find jsonkey \"LLPath\"", "ERROR", MB_ICONERROR | MB_OK);
149 exit(1);
150 }
151 if (value != "NULL" && value != "") {
152 mulock1 = true;
153 FILE* indexfile = _wfopen(lpFileName, L"r");
154 if (indexfile == NULL) {
155 MessageBoxA(nullptr, "failed to open index.js", "ERROR", MB_ICONERROR | MB_OK);
156 exit(1);
157 }
158 char OrgConte[1024] = "";
159 if (fgets(OrgConte, sizeof(OrgConte), indexfile) == NULL) {
160 OrgConte[0] = '\0';
161 }
162 size_t OrgSize = strlen(OrgConte);
163 fclose(indexfile);
164 if (strstr(OrgConte, "require(String.raw`") == NULL) {
165 indexfile = _wfopen(lpFileName, L"w+");
166 if (indexfile == NULL) {
167 if (!IsRunAsAdmin()) {

Callers

nothing calls this directly

Calls 4

IsRunAsAdminFunction · 0.70
RestartAsAdminFunction · 0.70
SetFileALLAccessPremsFunction · 0.70
endMethod · 0.45

Tested by

no test coverage detected