回答问题请看清题目然后回答,以下情况的回答不给分:
1.回答在9x下的代码不给分
2.回答非delphi的代码不给分
3.编译无法通过或者无用的代码不给分
对这个问题的答案没报什么希望,贴这个问题就是因为我的可用分比较多。
1.回答在9x下的代码不给分
2.回答非delphi的代码不给分
3.编译无法通过或者无用的代码不给分
对这个问题的答案没报什么希望,贴这个问题就是因为我的可用分比较多。
解决方案 »
- CreateOleObject()的参数有好多,比如'word.basic','word.application','excel.application'等,这些参数在哪里定义,哪里有说明?
- INI文件如何折行?
- 关于管道的问题
- delphi中怎么获得系统时间?
- 关于DBGrid的问题
- 新手求教!!!
- 从ini文件中读出来的“HKEY_LOCAL_MACHINE“是string ,怎样转化使其变为hkey啊
- 月薪1角钱的程序员
- 一郎Delphi学习笔记
- 求FastReport3.0轉簡體中文的方法(不好意思,實在是沒分了)
- 谁能给一个DBGRID 通过TextBox的值动态绑定数据的例子
- 请教DBGrid 录入中,怎样使光标锁定录入框有TEdit 的风格?
http://www.delphibbs.com/keylife/iblog_show.asp?xid=6679
http://community.csdn.net/Expert/topic/3567/3567620.xml?temp=.668606LYSoft版本:
http://blog.csdn.net/ly_liuyang/archive/2004/11/20/189013.aspx
虽然看上去上相似其实不一样的:)uses Windows, Dialogs, SysUtils, NTDDK, JwaWinNT, JwaWinType, JwaNtStatus, JwaAccCtrl, JwaAclApi, ntdll; const KGDT_NULL = 0; KGDT_R0_CODE = 8; KGDT_R0_DATA = 16; KGDT_R3_CODE = 24; KGDT_R3_DATA = 32; KGDT_TSS = 40; KGDT_R0_PCR = 48; KGDT_R3_TEB = 56; KGDT_VDM_TILE = 64; KGDT_LDT = 72; KGDT_DF_TSS = 80; KGDT_NMI_TSS = 88; type TGDT = record Limit, BaseLow, BaseHigh : Word; end; PHYSICAL_ADDRESS = Large_Integer; CALLGATE_DESCRIPTOR = record Offset_0_15, Selector: Word; GateDescriptor:Word; Offset_16_31: Word; end; implementation function ZwOpenSection; external 'ntdll.dll';function ZwClose; external 'ntdll.dll'; function SetDebugPrivilege(CanDebug: boolean): Boolean; function EnablePrivilege(hToken: Cardinal; PrivName: string; bEnable: Boolean): Boolean; var TP: Windows.TOKEN_PRIVILEGES; Dummy: Cardinal; begin TP.PrivilegeCount := 1; LookupPrivilegeValue(nil, pchar(PrivName), TP.Privileges[0].Luid); if bEnable then TP.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED else TP.Privileges[0].Attributes := 0; AdjustTokenPrivileges(hToken, False, TP, SizeOf(TP), nil, Dummy); Result := GetLastError = ERROR_SUCCESS; end;var hToken: Cardinal;begin OpenProcessToken(GetCurrentProcess, TOKEN_ADJUST_PRIVILEGES, hToken); Result := EnablePrivilege(hToken, SE_DEBUG_NAME, CanDebug); CloseHandle(hToken);end; function SetPhyscialMemorySectionCanBeWrited(hSection: THandle): boolean;label CleanUp;var pDacl, pNewDacl: JwaWinNT.PACL; pSD: JwaWinNT.PSECURITY_DESCRIPTOR; dwRes: DWORD; ea: EXPLICIT_ACCESS;begin Result := false; pDacl := nil; pNewDacl := nil; pSD := nil; dwRes := GetSecurityInfo(hSection, SE_KERNEL_OBJECT, DACL_SECURITY_INFORMATION, nil, nil, @pDacl, nil, pSD); if dwRes <> ERROR_SUCCESS then begin MessageDlg(Format('GetSecurityInfo Error %d', [dwRes]), mtError, [mbOK], 0); goto CleanUp; end; ZeroMemory(@ea, sizeof(EXPLICIT_ACCESS)); ea.grfAccessPermissions := SECTION_MAP_WRITE; ea.grfAccessMode := GRANT_ACCESS; ea.grfInheritance := NO_INHERITANCE; ea.Trustee.TrusteeForm := TRUSTEE_IS_NAME; ea.Trustee.TrusteeType := TRUSTEE_IS_USER; ea.Trustee.ptstrName := 'CURRENT_USER'; dwRes := SetEntriesInAcl(1, @ea, pDacl, pNewDacl); if dwRes <> ERROR_SUCCESS then begin MessageDlg(Format('SetEntriesInAcl Error : %d', [dwRes]), mtError, [mbOK], 0); goto CleanUp; end; dwRes := SetSecurityInfo(hSection, SE_KERNEL_OBJECT, DACL_SECURITY_INFORMATION, nil, nil, pNewDacl, nil); if dwRes <> ERROR_SUCCESS then begin MessageDlg(Format('SetSecurityInfo Error : %d', [dwRes]), mtError, [mbOK], 0); goto CleanUp; end; Result := true; CleanUp: if pSD<>nil then LocalFree(Cardinal(pSD)); if pNewDacl<>nil then LocalFree(Cardinal(pNewDacl));end; function OpenPhysicalMemory: THandle;var hSection : THandle; status: NTSTATUS; objName: UNICODE_STRING; objectAttributes: OBJECT_ATTRIBUTES;begin Result := 0; RtlInitUnicodeString(@objName, '\Device\PhysicalMemory'); InitializeObjectAttributes(@objectAttributes, @objName, OBJ_CASE_INSENSITIVE or OBJ_KERNEL_HANDLE, 0, nil); status := ZwOpenSection(hSection, SECTION_MAP_READ or SECTION_MAP_WRITE, @objectAttributes); if (status = STATUS_ACCESS_DENIED) then begin status := ZwOpenSection(hSection, READ_CONTROL or WRITE_DAC, @objectAttributes); if status = STATUS_SUCCESS then SetPhyscialMemorySectionCanBeWrited(hSection); ZwClose(hSection); status := ZwOpenSection(hSection, SECTION_MAP_READ or SECTION_MAP_WRITE, @objectAttributes); end; if status = STATUS_SUCCESS then Result :=hSection;end; procedure ClosePhysicalMemory(hPhysicalMemorySection: THandle);begin ZwClose(hPhysicalMemorySection);end; function AddressIn4MBPage(Address: ULONG): Boolean;begin Result := (Address > 0) and ($80000000<=Address) and (Address<$A0000000)end; http://lysoft.7u7.net