|
|
|
[原创]CodeGear RAD Studio 2009 RTM V12.0.3170.16989 绿化完全版[已更新]
补充一句,要破解的可到www.2ccc.com论坛找,只要直接对bds.EXE破解就可以了。 |
|
[转帖]Delphi Distiller v1.41
现在都1.44版本了。 |
|
MessageBox(0,(LPCTSTR)"vs2008",0,MB_ICONWARNING);这一句经过VS2008编译,执行起来怎么输出有乱码呢???
MessageBox(0,"vs2008",0,MB_ICONWARNING); |
|
|
|
[原创]Microsoft Visual C++ 2008 专业绿色版 IDE v1.0.3[更新集成SP1]停止下载
这问题我都不知答了多少次了 请仔细查看 压缩包内的说明,里面有特别说明解决该方法 |
|
|
|
|
|
[求助]请教,PE文件的资源替换问题。
DEMO UpdateIcons('c:\test.exe','C:\xx.ico'); procedure UpdateIcons(const FileName, IcoFileName: String); implementation function EnumLangsFunc(hModule: Cardinal; lpType, lpName: PAnsiChar; wLanguage: Word; lParam: Integer): BOOL; stdcall; begin PWord(lParam)^ := wLanguage; Result := False; end; function GetResourceLanguage(hModule: Cardinal; lpType, lpName: PAnsiChar; var wLanguage: Word): Boolean; begin wLanguage := 0; EnumResourceLanguages(hModule, lpType, lpName, @EnumLangsFunc, Integer(@wLanguage)); Result := True; end; procedure UpdateIcons(const FileName, IcoFileName: String); type PIcoItemHeader = ^TIcoItemHeader; TIcoItemHeader = packed record Width: Byte; Height: Byte; Colors: Byte; Reserved: Byte; Planes: Word; BitCount: Word; ImageSize: DWORD; end; PIcoItem = ^TIcoItem; TIcoItem = packed record Header: TIcoItemHeader; Offset: DWORD; end; PIcoHeader = ^TIcoHeader; TIcoHeader = packed record Reserved: Word; Typ: Word; ItemCount: Word; Items: array [0..MaxInt shr 4 - 1] of TIcoItem; end; PGroupIconDirItem = ^TGroupIconDirItem; TGroupIconDirItem = packed record Header: TIcoItemHeader; Id: Word; end; PGroupIconDir = ^TGroupIconDir; TGroupIconDir = packed record Reserved: Word; Typ: Word; ItemCount: Word; Items: array [0..MaxInt shr 4 - 1] of TGroupIconDirItem; end; function IsValidIcon(P: Pointer; Size: Cardinal): Boolean; var ItemCount: Cardinal; begin Result := False; if Size < Cardinal(SizeOf(Word) * 3) then Exit; if (PChar(P)[0] = 'M') and (PChar(P)[1] = 'Z') then Exit; ItemCount := PIcoHeader(P).ItemCount; if Size < Cardinal((SizeOf(Word) * 3) + (ItemCount * SizeOf(TIcoItem))) then Exit; P := @PIcoHeader(P).Items; while ItemCount > Cardinal(0) do begin if (Cardinal(PIcoItem(P).Offset + PIcoItem(P).Header.ImageSize) < Cardinal(PIcoItem(P).Offset)) or (Cardinal(PIcoItem(P).Offset + PIcoItem(P).Header.ImageSize) > Cardinal(Size)) then Exit; Inc(PIcoItem(P)); Dec(ItemCount); end; Result := True; end; var H: THandle; M: HMODULE; R: HRSRC; Res: HGLOBAL; GroupIconDir, NewGroupIconDir: PGroupIconDir; I: Integer; wLanguage: Word; F: TFile; Ico: PIcoHeader; N: Cardinal; NewGroupIconDirSize: LongInt; begin if Win32Platform <> VER_PLATFORM_WIN32_NT then Error('仅支持 Windows NT 和后期版本'); Ico := nil; try { Load the icons } F := TFile.Create(IcoFileName, fdOpenExisting, faRead, fsRead); try N := F.CappedSize; if Cardinal(N) > Cardinal($100000) then { sanity check } Error('图标文件太大'); GetMem(Ico, N); F.ReadBuffer(Ico^, N); finally F.Free; end; { Ensure the icon is valid } if not IsValidIcon(Ico, N) then Error('图标文件无效'); { Update the resources } H := BeginUpdateResource(PChar(FileName), False); if H = 0 then ErrorWithLastError('BeginUpdateResource 无效 (1)'); try M := LoadLibraryEx(PChar(FileName), 0, LOAD_LIBRARY_AS_DATAFILE); if M = 0 then ErrorWithLastError('LoadLibraryEx 无效 (1)'); try { Load the 'MAINICON' group icon resource } R := FindResource(M, 'MAINICON', RT_GROUP_ICON); if R = 0 then ErrorWithLastError('FindResource 无效 (1)'); Res := LoadResource(M, R); if Res = 0 then ErrorWithLastError('LoadResource 无效 (1)'); GroupIconDir := LockResource(Res); if GroupIconDir = nil then ErrorWithLastError('LockResource 无效 (1)'); { Delete 'MAINICON' } if not GetResourceLanguage(M, RT_GROUP_ICON, 'MAINICON', wLanguage) then Error('GetResourceLanguage 无效 (1)'); if not UpdateResource(H, RT_GROUP_ICON, 'MAINICON', wLanguage, nil, 0) then ErrorWithLastError('UpdateResource 无效 (1)'); { Delete the RT_ICON icon resources that belonged to 'MAINICON' } for I := 0 to GroupIconDir.ItemCount-1 do begin if not GetResourceLanguage(M, RT_ICON, MakeIntResource(GroupIconDir.Items[I].Id), wLanguage) then Error('GetResourceLanguage 无效 (2)'); if not UpdateResource(H, RT_ICON, MakeIntResource(GroupIconDir.Items[I].Id), wLanguage, nil, 0) then ErrorWithLastError('UpdateResource 无效 (2)'); end; { Build the new group icon resource } NewGroupIconDirSize := 3*SizeOf(Word)+Ico.ItemCount*SizeOf(TGroupIconDirItem); GetMem(NewGroupIconDir, NewGroupIconDirSize); try { Build the new group icon resource } NewGroupIconDir.Reserved := GroupIconDir.Reserved; NewGroupIconDir.Typ := GroupIconDir.Typ; NewGroupIconDir.ItemCount := Ico.ItemCount; for I := 0 to NewGroupIconDir.ItemCount-1 do begin NewGroupIconDir.Items[I].Header := Ico.Items[I].Header; NewGroupIconDir.Items[I].Id := I+1; //assumes that there aren't any icons left end; { Update 'MAINICON' } for I := 0 to NewGroupIconDir.ItemCount-1 do if not UpdateResource(H, RT_ICON, MakeIntResource(NewGroupIconDir.Items[I].Id), 2052, Pointer(DWORD(Ico) + Ico.Items[I].Offset), Ico.Items[I].Header.ImageSize) then ErrorWithLastError('UpdateResource 无效 (3)'); { Update the icons } if not UpdateResource(H, RT_GROUP_ICON, 'MAINICON', 2052, NewGroupIconDir, NewGroupIconDirSize) then ErrorWithLastError('UpdateResource 无效 (4)'); finally FreeMem(NewGroupIconDir); end; finally FreeLibrary(M); end; except EndUpdateResource(H, True); { discard changes } raise; end; if not EndUpdateResource(H, False) then ErrorWithLastError('EndUpdateResource 无效'); finally FreeMem(Ico); end; end; |
|
|
|
[求助]怎么拦截本窗口中WEBBROWSER中发送的HTTP头信息
直接在本程序HOOK Send API |
|
[求助]怎么才能不让exe释放dll文件
看我这里的回贴http://bbs.pediy.com/showthread.php?t=70052 |
|
[原创]vcpkg 3.1 - 让VC6支持无限多平台编译
没说明,配置文件如何增加其它平台都没说。。。。。。。。。。。。 |
|
[求助]如何从资源加载dll
看看我这个合用不,不过我这是用Delphi的,下面是一个例子 也可以下载去看看 http://u.skygz.com/mypane.aspx?down=ok&filepath=skygz%2f%b2%fa%c6%b7%2f%b4%d3%c4%da%b4%e6%bc%d3%d4%d8DLL%b2%a2%b5%f7%d3%c3_%ba%af%ca%fd%bf%e2_FOR_Delphi_v1_0_0_1.rar {$R MyDll.Res} {.$DEFINE UseDll} {$IFDEF UseDLL} Const RawLibApi = 'RawLibApi.DLL'; Function _LoadLibraryA(FileName: PAnsiChar): hModule; Stdcall; External RawLibApi; Function _LoadLibraryW(FileName: PWideChar): hModule; Stdcall; External RawLibApi; Function _LoadLibraryFromResourceA(Instance: THandle; Name, ResType: PAnsiChar): hModule; Stdcall; External RawLibApi; Function _LoadLibraryFromResourceW(Instance: THandle; Name, ResType: PWideChar): hModule; Stdcall; External RawLibApi; Function _LoadLibraryFromResourceIDA(Instance: THandle; ResID: Integer; ResType: PAnsiChar): hModule; Stdcall; External RawLibApi; Function _LoadLibraryFromResourceIDW(Instance: THandle; ResID: Integer; ResType: PWideChar): hModule; Stdcall; External RawLibApi; Function _LoadLibraryMem(lpMemory: Pointer): hModule; Stdcall; External RawLibApi; Function _GetProcAddress(hModule: hModule; lpProcName: LPCSTR): Pointer; Stdcall; External RawLibApi; Procedure _FreeLibrary(hModule: hModule); Stdcall; External RawLibApi; Procedure _LoadMemRunExe(lpMemory: Pointer); Stdcall; External RawLibApi; {$ELSE} Uses MemLibLoader; {$ENDIF} Var DllHandle: THandle; MsgBox: Function(lpText, LpCaption: PAnsiChar): Integer; Stdcall; MsgBoxEx: Function(lpText, LpCaption: PAnsiChar; UType: UINT): Integer; Stdcall; Procedure TFrmMain.Cmd_ByNameClick(Sender: TObject); Begin If @MsgBox <> Nil Then MsgBox('这是按名称调用的函数', '提示'); End; Procedure TFrmMain.CmdByIndexClick(Sender: TObject); Begin If @MsgBoxEx <> Nil Then MsgBoxEx('这是按序号调用的函数', '提示', MB_ICONINFORMATION Or MB_OKCANCEL); End; Procedure TFrmMain.SetControls(B: Boolean); Begin Cmd_Load.Enabled := Not B; Cmd_Free.Enabled := B; End; Procedure TFrmMain.Cmd_LoadClick(Sender: TObject); Var FileName: String; Mem: TMemoryStream; FileArray: Array Of Byte; Begin SetControls(true); FileName := ExtractFilePath(ParamStr(0)) + 'MyDll.Dll'; Case CBLoadType.ItemIndex Of 0: //内存 Begin Mem := TMemoryStream.Create; Mem.LoadFromFile(FileName); DllHandle := _LoadLibraryMem(Mem.Memory); Mem.Free; End; 1: //数组 Begin Mem := TMemoryStream.Create; Mem.LoadFromFile(FileName); SetLength(FileArray, Mem.Size); Mem.ReadBuffer(FileArray[0], Mem.Size); DllHandle := _LoadLibraryMem(FileArray); Mem.Free; End; 2: DllHandle := _LoadLibraryFromResourceA(HInstance, 'MyDLL', 'DLL'); //资源 3: DllHandle := _LoadLibraryA(PChar(FileName)); //文件 End; If DllHandle <> 0 Then Begin @MsgBox := _GetProcAddress(DllHandle, 'MsgBox'); @MsgBoxEx := _GetProcAddress(DllHandle, MakeIntResource($1)); End Else SetControls(false); End; Procedure TFrmMain.Cmd_FreeClick(Sender: TObject); Begin SetControls(false); @MsgBox := Nil; @MsgBoxEx := Nil; _FreeLibrary(DllHandle); End; Procedure TFrmMain.FormCreate(Sender: TObject); Begin CBLoadType.ItemIndex := 0; End; //============================================================================== {$I MSComm32.Inc} Procedure TFrmMain.CmdTestClick(Sender: TObject); Var ActiveXDllHandle: THandle; DllGetClassObject: Function(Const CLSID, IID: TGUID; Var Obj): HResult; Stdcall; vClassFactory: IClassFactory; v: IMSComm; Begin // ConvFileToArray('C:\Windows\System32\MSComm32.OCX', 'MSComm32'); ActiveXDllHandle := _LoadLibraryMem(@MSComm32); @DllGetClassObject := _GetProcAddress(ActiveXDllHandle, 'DllGetClassObject'); If @DllGetClassObject <> Nil Then Begin DllGetClassObject(CLASS_MSComm, IClassFactory, vClassFactory); If Assigned(vClassFactory) Then Begin vClassFactory.CreateInstance(Nil, IMSComm, v); If Assigned(v) Then Begin v.AboutBox; v := Nil; End; vClassFactory := Nil; End; _FreeLibrary(ActiveXDllHandle); End; End; |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值