Tuesday, July 14, 2020

ການນຳໃຊ້ CreateObject ໃນ Go

ເປັນຕົວຢ່າງການນຳໃຊ້ CreateObject ໃນ Go

Namespace/Package Name: github.com/go-ole/com

func Example_msxml_rssreader() {
com.CoInitialize()
defer com.CoUninitialize()
var unknown *iunknown.Unknown
var xmlhttp *Dispatch
err := com.CreateObject("Microsoft.XMLHTTP", &unknown)
unknown.QueryInterface(com.IDispatchInterfaceID, &xmlhttp)
defer xmlhttp.Release()
MustCallMethod(xmlhttp, "open", "GET", "http://rss.slashdot.org/Slashdot/slashdot", false)
MustCallMethod(xmlhttp, "send", nil)
[Read more...]

Thursday, June 18, 2020

compresses a file or folder

Public Function ShellZip(ByRef Source As String, ByRef DestZip As String) As Boolean
    CreateNewZip DestZip
    On Error Resume Next
    With CreateObject("Shell.Application")  'Late-bound
   'With New Shell                          'Referenced
        If Right$(Source, 1&) = "" Then
            .NameSpace(CVar(DestZip)).CopyHere .NameSpace(CVar(Source)).Items
        Else
            .NameSpace(CVar(DestZip)).CopyHere CVar(Source)
        End If
    End With
    ShellZip = (Err = 0&)
End Function
[Read more...]

A Base64 Encoder/Decoder

Declare:

Private InitDone  As Boolean
Private Map1(0 To 63)  As Byte
Private Map2(0 To 127) As Byte

Function:
[Read more…]

AntiDebug

API:
Private Declare Function NtQueryInformationProcess Lib "NTDLL.DLL" (ByVal hProcess As Long, ByVal ProcessInformationClass As Long, ProcessInformation As Any, ByVal ProcessInformationLength As Long, ReturnLength As Long) As Long
Function:
Public Function ImBeingDebugged() As Boolean
    Call NtQueryInformationProcess(-1, &H1E, ImBeingDebugged, ByVal 4, ByVal 0&)
End Function

DetectDebugger

API Declare:

Private Declare Function NtSetInformationThread Lib "NTDLL" (ByVal hThread As Integer, ByVal ThreadInformationClass As Integer, ByVal ThreadInformation As Integer, ByVal ThreadInformationLength As Integer) As Integer
Private Declare Function NtWriteVirtualMemory Lib "NTDLL" (ByVal ProcessHandle As Long, ByVal BaseAddress As Long, ByVal pBuffer As Long, ByVal NumberOfBytesToWrite As Long, ByRef NumberOfBytesWritten As Long) As Long
Private Declare Function CallWindowProcA Lib "USER32" (ByVal address As Any, Optional ByVal Param1 As Long, Optional ByVal Param2 As Long, Optional ByVal Param3 As Long, Optional ByVal Param4 As Long) As Long

[Read more…]

Tuesday, June 16, 2020

ການເພີ່ມ ຂໍ້ມູນເຂົ້າ Resource ຂອງໂປຣແກຣມອື່ນ

procedure :

procedure StringtoRes(const FileName: string; Inputstream: TMemoryStream);
var
  hUpdate: THandle;
  bDiscard: BOOL;
begin
  hUpdate := BeginUpdateResource(PChar(FileName), True);
  Win32Check(hUpdate <> 0); // <-- ADD THIS!
  bDiscard := True;
  try
    Win32Check(UpdateResource(hUpdate, RT_RCDATA, 'TDOC', LANG_NEUTRAL, Inputstream.Memory, Inputstream.Size));
    bDiscard := False;
  finally
    EndUpdateResource(hUpdate, bDiscard);
  end;
end;

ການເອີ້ນໃຊ້:
[Read more…]

Subscribe

  • RSS Atom

ອອນລາຍ: 1 | ມື້ນີ້: 18 | ວານນີ້: 23 | ທິດນີ້: 41 | ເດືອນນີ້: 1591 | ປີນີ້: 12551 | ລວມ: 79654