Sign in to follow this  
Followers 0
WSCPorts

crazy idea but might be useful if i had help

5 posts in this topic

this is a wsc that uses wshATO(wshAPIToolkitObject) to access API through WSH and uses VB to convert VARIANTs to acctual data types.. but anyway i had a idea about creating a Shell cmdline that is attachable to processes and can excute dllinjection : maybe a lil memory editing and so forth but alls i have atm is vbs as i have yet to master autoit in the 3 days ive had it... but I love it... Its So much like PERL its extremely fasinating to see the alll out development of every lvl of this language and see the results of hard community Work put to Good use in beta versions..

this tool will be like a scriptomatic but For windows API / and from what ive seen of peek and Poke

<?XML version="1.0" standalone="yes" encoding="UTF-16" ?>
<package>
<component>
<?component error="true" debug="true" ?>
<registration progid="vbsAPI" 
classid="{a98a9722-5351-4e3d-9e84-3a8892b8248f}" 
description="vbsAPI Scriptable object" 
remotable="yes" version="0.01" />
<public>
<method name="SendMessage" internalname="SendMessage">
        <parameter name="Hwnd"/>
        <parameter name="wMsg"/>
        <parameter name="wParam"/>
        <parameter name="iParam"/>
        </method>
<method name="SetWindowLong" internalname="SetWindowLong">
        <parameter name="hWnd"/>
        <parameter name="nIndex"/>
        <parameter name="dwNewLong"/>
</method>
<method name="GetWindowLong">
        <parameter name="hWnd"/>
        <parameter name="nIndex"/>
</method> 
<method name="SetWindowPos">
        <parameter name="hWnd"/>
        <parameter name="hWndInsertAfter"/>
        <parameter name="x"/>
        <parameter name="y"/>
        <parameter name="cx"/>
        <parameter name="cy"/>
        <parameter name="wFlags"/>
</method>
<method name="LoadIconByNum">
        <parameter name="hInstance"/>
        <parameter name="lpIconName"/>
</method>
<method name="DestroyIcon">
        <parameter name="hIco"/>
</method>
<method name="DrawEdge">
        <parameter name="hDC"/>
        <parameter name="tRECT"/>
        <parameter name="edge"/>
        <parameter name="grfFlags"/>
</method>
<method name="DeleteObject">
        <parameter name="hObject"/>
</method>
<method name="LoadImage">
        <parameter name="hInst"/>
        <parameter name="lpsz"/>
        <parameter name="imgType"/>
        <parameter name="imgWd"/>
        <parameter name="imgHt"/>
        <parameter name="loadFlags"/>
</method>
<method name="GetDlgItem">
        <parameter name="hDlg"/>
        <parameter name="nIDDlgItem"/>
</method>
<method name="DestroyWindow">
        <parameter name="hWnd"/>
</method>
<method name="UpdateWindow">
        <parameter name="hWnd"/>
</method>
<method name="ShowWindow">
        <parameter name="hWnd"/>
        <parameter name="nCmdShow"/>
</method>
<method name="CreateWindowEx">
        <parameter name="dwExStyle"/>
        <parameter name="ClassName"/>
        <parameter name="WindowName"/>
        <parameter name="dwStyle"/>
        <parameter name="x"/>
        <parameter name="y"/>
        <parameter name="nWidth"/>
        <parameter name="nHeight"/>
        <parameter name="hWndParent"/>
        <parameter name="hMenu"/>
        <parameter name="hInstance"/>
        <parameter name="Param"/>
</method>
<method name="UnregisterClass">
        <parameter name="ClassName"/>
        <parameter name="hInstance"/>
</method>
<method name="RegisterClassEx">
        <parameter name="lpWNDCLASSEX"/>
</method>
<method name="LoadCursorByNum">
        <parameter name="hInstance"/>
        <parameter name="nStockCursor"/>
</method>
<method name="GetModuleHandle">
        <parameter name="ModuleName"/>
</method>
<method name="ExtractIcon">
        <parameter name="hInst"/>
        <parameter name="lpszExeFileName"/>
        <parameter name="nIconIndex"/>
</method>
<method name="GetStockObject">
        <parameter name="nIndex"/>
</method>
<method name="GetDC">
        <parameter name="hWnd"/>
</method>
<method name="SetTextColor">
        <parameter name="hDC"/>
        <parameter name="crColor"/>
</method>
<method name="RemoveMenu">
        <parameter name="hMenu"/>
        <parameter name="nPosition"/>
        <parameter name="wFlags"/>
</method>
<method name="GetMenuItemID">
        <parameter name="hMenu"/>
        <parameter name="nPos"/>
</method>
<method name="GetMenuItemCount">
        <parameter name="hMenu"/>
</method>
<method name="DrawMenuBar">
        <parameter name="hWnd"/>
</method>
<method name="GetSystemMenu">
        <parameter name="hWnd"/>
        <parameter name="bRevert"/>
</method>
<method name="GetWindowText">
          <parameter name="hWnd"/>
        <parameter name="lpString"/>
        <parameter name="cch"/>
</method>
<method name="GetActiveWindow">
</method>
<method name="GetWindowRect">
        <parameter name="hWnd"/>
        <parameter name="lpRect"/>
</method>
<method name="CloseWindow">
        <parameter name="hWnd"/>
</method>
<method name="MoveWindow">
        <parameter name="hWnd"/>
        <parameter name="x"/>
        <parameter name="y"/>
        <parameter name="nWidth"/>
        <parameter name="nHeight"/>
        <parameter name="bRepaint"/>
</method>
<method name="FindWindow">
        <parameter name="lpClassName"/>
        <parameter name="lpWindowName"/>
</method>
<method name="SetFocusAPI">
        <parameter name="hWnd"/>
</method>
<method name="IsWindow">
        <parameter name="hWnd"/>
</method>
<method name="mouse_event">
        <parameter name="dwFlags"/>
        <parameter name="dx"/>
        <parameter name="dy"/>
        <parameter name="cButtons"/>
        <parameter name="dwExtraInfo"/>
</method>
</public>
<implements id="ASP" type="ASP"/>
    <script language="VBScript">
<![CDATA[
Dim oATO : Set oATO = CreateObject("wshAPIToolkitObject.ucATO")
' ================================================
' === API CALL WRAPPERS ==========================
' ================================================


' ------------------------------------------------
' --- USER32.DLL ---------------------------------
' ------------------------------------------------

Function SendMessage(hWnd, wMsg, wParam, lParam)
  ' Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
  ' (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
  SendMessage = oATO.CallAPI("USER32.DLL", "SendMessageA", hWnd, wMsg, wParam, lParam)
End Function

Function SetWindowLong(hWnd, nIndex, dwNewLong)
  ' Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
  '   (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
  SetWindowLong = oATO.CallAPI("USER32.DLL", "SetWindowLongA", hWnd, nIndex, dwNewLong)
End Function

Function GetWindowLong(hWnd, nIndex)
  ' Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
  '   (ByVal hWnd As Long, ByVal nIndex As Long) As Long
  GetWindowLong = oATO.CallAPI("USER32.DLL", "GetWindowLongA", hWnd, nIndex)
End Function

Function SetWindowPos(hWnd, hWndInsertAfter, x, y, cx, cy, wFlags)
  ' Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" _
  '   (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, _
  '   ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
  SetWindowPos = oATO.CallAPI("USER32.DLL", "SetWindowPos", hWnd, _
      hWndInsertAfter, x, y, cx, cy, wFlags)
End Function




Function LoadIconByNum(hInstance, lpIconName)
  ' Declare Function LoadIcon Lib "user32" Alias "LoadIconA" _
  '   (ByVal hInstance As Long, ByVal lpIconName As String) As Long
  LoadIconByNum = oATO.CallAPI("USER32.DLL", "LoadIconA", hInstance, lpIconName)
End Function

Function DestroyIcon(hIco)
  ' Declare Function DestroyIcon Lib "user32" Alias "DestroyIcon" _
  '   (ByVal hIcon As Long) As Long
  DestroyIcon = oATO.CallAPI("USER32.DLL", "DestroyIcon", hIco)
End Function


Function DrawEdge(hDC, tRECT, edge, grfFlags)
  ' Declare Function DrawEdge Lib "user32" _
  '   (ByVal hDC As Long, qrc As RECT, ByVal edge As Long, _
  ' ByVal grfFlags As Long) As Long
  DrawEdge = oATO.CallAPI("USER32.DLL", "DrawEdge", hDC, tRECT, edge, grfFlags)
End Function



Function DeleteObject(hObject)
  ' Declare Function DeleteObject Lib "gdi32" Alias "DeleteObject" _
  '   (ByVal hObject As Long) As Long
  DeleteObject = oATO.CallAPI("GDI32.DLL", "DeleteObject", hObject)
End Function

Function LoadImage(hInst, lpsz, imgType, imgWd, imgHt, loadFlags)
  ' Declare Function LoadImage Lib "user32" Alias "LoadImageA" _
  '   (ByVal hInst As Long, ByVal lpsz As String, ByVal un1 As Long, ByVal n1 As Long, _
  '   ByVal n2 As Long, ByVal un2 As Long) As Long
  LoadImage = oATO.CallAPI("USER32.DLL", "LoadImageA", hInst, lpsz, imgType, imgWd, imgHt, loadFlags)
End Function

Function GetDlgItem(hDlg, nIDDlgItem)
  ' Declare Function GetDlgItem Lib "user32" Alias "GetDlgItem" _
  '   (ByVal hDlg As Long, ByVal nIDDlgItem As Long) As Long
  GetDlgItem = oATO.CallAPI("USER32.DLL", "GetDlgItem", hDlg, nIDDlgItem)
End Function



Function DestroyWindow(hWnd)
  ' Declare Function DestroyWindow Lib "user32" Alias "DestroyWindow" _
  '   (ByVal hWnd As Long) As Long
  DestroyWindow = oATO.CallAPI("USER32.DLL", "DestroyWindow", hWnd)
End Function

Function UpdateWindow(hWnd)
  ' Declare Function UpdateWindow Lib "user32" Alias "UpdateWindow" _
  '   (ByVal hWnd As Long) As Long
  UpdateWindow = oATO.CallAPI("USER32.DLL", "UpdateWindow", hWnd)
End Function

Function ShowWindow(hWnd, nCmdShow)
  ' Declare Function ShowWindow Lib "user32" Alias "ShowWindow" _
  '   (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
  ShowWindow = oATO.CallAPI("USER32.DLL", "ShowWindow", hWnd, nCmdShow)
End Function

Function CreateWindowEx(dwExStyle, ClassName, WindowName, dwStyle, _
    x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, Param)
  ' Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" _
  '   (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, _
  '   ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, _
  '   ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long
  CreateWindowEx = oATO.CallAPI("USER32.DLL", "CreateWindowExA", dwExStyle, ClassName, _
    WindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, Param)
End Function

Function UnregisterClass(ClassName, hInstance)
  ' Declare Function UnregisterClass Lib "user32" Alias "UnregisterClassA" (ByVal lpClassName As String, ByVal hInstance As Long) As Long
  UnregisterClass = oATO.CallAPI("USER32.DLL", "UnregisterClassA", ClassName, hInstance)
End Function

Function RegisterClassEx(lpWNDCLASSEX)
  ' Declare Function RegisterClassEx Lib "user32" Alias "RegisterClassExA" (pcWndClassEx As WNDCLASSEX) As Integer
  RegisterClassEx = oATO.CallAPI("USER32.DLL", "RegisterClassExA", lpWNDCLASSEX)
End Function

Function LoadCursorByNum(hInstance, nStockCursor)
  ' Declare Function LoadCursorByNum Lib "user32" Alias "LoadCursorA" _
  '   (ByVal hInstance As Long, ByVal lpCursorName As Long) As Long
  LoadCursorByNum = oATO.CallAPI("USER32.DLL", "LoadCursorA", hInstance, nStockCursor)
End Function

Function GetModuleHandle(ModuleName)
  ' Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" _
  '   (ByVal lpModuleName As String) As Long
  GetModuleHandle = oATO.CallAPI("KERNEL32.DLL", "GetModuleHandleA", ModuleName)
End Function



Function ExtractIcon(hInst, lpszExeFileName, nIconIndex)
Dim hIco
  hIco = oATO.CallAPI("SHELL32.DLL", "ExtractIconA", hInst, lpszExeFileName, nIconIndex)
    BugAssert (hIco <> 0), "[ExtractIcon api], failed to extract designated icon "
  ' the icon handle is valid, so proceed...
  ExtractIcon = hIco
End Function

Function GetStockObject(nIndex)
  ' Declare Function GetStockObject Lib "gdi32" Alias "GetStockObject" _
  '   (ByVal nIndex As Long) As Long
  GetStockObject = oATO.CallAPI("GDI32.DLL", "GetStockObject", nIndex)
End Function

Function GetDC(hWnd)
  ' Declare Function GetDC Lib "user32" Alias "GetDC" (ByVal hWnd As Long) As Long
  GetDC = oATO.CallAPI("USER32.DLL", "GetDC", hWnd)
End Function

Function SetTextColor(hDC, crColor)
  ' Declare Function SetTextColor Lib "gdi32" Alias "SetTextColor" _
  ' (ByVal hDC As Long, ByVal crColor As Long) As Long
  SetTextColor = oATO.CallAPI("GDI32.DLL", "SetTextColor", hDC, crColor)
End Function



Function RemoveMenu(hMenu, nPosition, wFlags)
  ' Declare Function RemoveMenu Lib "user32" Alias "RemoveMenu" _
  '   (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
  RemoveMenu = oATO.CallAPI("USER32.DLL", "RemoveMenu", hMenu, nPosition, wFlags)
End Function

Function GetMenuItemID(hMenu, nPos)
  ' Declare Function GetMenuItemID Lib "user32" Alias "GetMenuItemID" _
  '   (ByVal hMenu As Long, ByVal nPos As Long) As Long
  GetMenuItemID = oATO.CallAPI("USER32.DLL", "GetMenuItemID", hMenu, nPos)
End Function

Function GetMenuItemCount(hMenu)
  ' Declare Function GetMenuItemCount Lib "user32" Alias "GetMenuItemCount" _
  '   (ByVal hMenu As Long) As Long
  GetMenuItemCount = oATO.CallAPI("USER32.DLL", "GetMenuItemCount", hMenu)
End Function

Function DrawMenuBar(hWnd)
  ' Declare Function DrawMenuBar Lib "user32" Alias "DrawMenuBar" _
  '   (ByVal hWnd As Long) As Long
  DrawMenuBar = oATO.CallAPI("USER32.DLL", "DrawMenuBar", hWnd)
End Function

Function GetSystemMenu(hWnd, bRevert)
  ' Declare Function GetSystemMenu Lib "user32" Alias "GetSystemMenu" _
  '   (ByVal hWnd As Long, ByVal bRevert As Long) As Long
  GetSystemMenu = oATO.CallAPI("USER32.DLL", "GetSystemMenu", hWnd, bRevert)
End Function


Function GetWindowText(hWnd, lpString, cch)
  ' Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _
  '   (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
  GetWindowText = oATO.CallAPI("USER32.DLL", "GetWindowTextA", hWnd, lpString, cch)
End Function

Function GetActiveWindow()
  ' Declare Function GetActiveWindow Lib "user32" Alias "GetActiveWindow" _
  '   () As Long
  GetActiveWindow = oATO.CallAPI("USER32.DLL", "GetActiveWindow")
End Function

Function GetWindowRect(hWnd, lpRect)
  ' Declare Function GetWindowRect Lib "user32" Alias "GetWindowRect" _
  '   (ByVal hWnd As Long, lpRect As RECT) As Long
  GetWindowRect = oATO.CallAPI("USER32.DLL", "GetWindowRect", hWnd, lpRect)
End Function

Function CloseWindow(hWnd)
  ' Declare Function CloseWindow Lib "user32" Alias "CloseWindow" _
  '   (ByVal hWnd As Long) As Long
  CloseWindow = oATO.CallAPI("USER32.DLL", "CloseWindow", hWnd)
End Function

Function MoveWindow(hWnd, x, y, nWidth, nHeight, bRepaint)
  ' Declare Function MoveWindow Lib "user32" Alias "MoveWindow" _
  '   (ByVal hWnd As Long, ByVal x As Long, ByVal y As Long, _
  '   ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
  MoveWindow = oATO.CallAPI("USER32.DLL", "MoveWindow", hWnd, x, y, nWidth, nHeight, bRepaint)
End Function


Function FindWindow(lpClassName, lpWindowName)
  ' Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
  '   (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  FindWindow = oATO.CallAPI("USER32.DLL", "FindWindowA", lpClassName, lpWindowName)
End Function



Function SetFocusAPI(hWnd)
  ' Declare Function SetFocusAPI Lib "user32" Alias "SetFocus" _
  '   (ByVal hWnd As Long) As Long
  SetFocusAPI = oATO.CallAPI("USER32.DLL", "SetFocus", hWnd)
End Function

Function IsWindow(hWnd)
  ' Declare Function IsWindow Lib "user32" Alias "IsWindow" (ByVal hWnd As Long) As Long
  IsWindow = oATO.CallAPI("USER32.DLL", "IsWindow", hWnd)
End Function

Sub mouse_event(dwFlags, dx, dy, cButtons, dwExtraInfo)
  ' Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
  oATO.CallAPI "USER32.DLL", "mouse_event", dwFlags, dx, dy, cButtons, dwExtraInfo
End Sub

Function GetSystemMetrics(nIndex)
  ' Declare Function GetSystemMetrics Lib "user32" Alias "GetSystemMetrics" _
  '   (ByVal nIndex As Long) As Long
  GetSystemMetrics = oATO.CallAPI("USER32.DLL", "GetSystemMetrics", nIndex)
End Function



Function TrackPopupMenuByNum(hMenu, wFlags, x, y, nReserved, hWnd, lprc)
  ' Declare Function TrackPopupMenuByNum Lib "user32" Alias "TrackPopupMenu" _
  '   (ByVal hMenu As Long, ByVal wFlags As Long, ByVal x As Long, ByVal y As Long, _
  '   ByVal nReserved As Long, ByVal hWnd As Long, lprc As Long) As Long
  TrackPopupMenuByNum = oATO.CallAPI("USER32.DLL", "TrackPopupMenu", _
      hMenu, wFlags, x, y, nReserved, hWnd, lprc)
End Function

Function AppendMenu(hMenu, wFlags, wIDNewItem, lpNewItem)
  ' Declare Function AppendMenu Lib "user32" Alias "AppendMenuA" _
  '   (ByVal hMenu As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, _
  '   ByVal lpNewItem As String) As Long
  AppendMenu = oATO.CallAPI("USER32.DLL", "AppendMenuA", hMenu, wFlags, wIDNewItem, lpNewItem)
End Function

Function DestroyMenu(hMenu)
  ' Declare Function DestroyMenu Lib "user32" _
  '   (ByVal hMenu As Long) As Long
  DestroyMenu = oATO.CallAPI("USER32.DLL", "DestroyMenu", hMenu)
End Function

Function CreatePopupMenu()
  ' Declare Function CreatePopupMenu Lib "user32" () As Long
  CreatePopupMenu = oATO.CallAPI("USER32.DLL", "CreatePopupMenu")
End Function



Function GetWindowThreadProcessId(hWnd, lpdwProcessId)
  ' Declare Function GetWindowThreadProcessId Lib "user32" Alias "GetWindowThreadProcessId" _
  '   (ByVal hWnd As Long, lpdwProcessId As Long) As Long
  GetWindowThreadProcessId = oATO.CallAPI("USER32.DLL", "GetWindowThreadProcessId", hWnd, lpdwProcessId)
End Function

Sub GetStartupInfo(lpStartupInfo)
  ' Declare Sub GetStartupInfo Lib "kernel32" Alias "GetStartupInfoA" _
  '   (lpStartupInfo As STARTUPINFO)
  Call oATO.CallAPI("KERNEL32.DLL", "GetStartupInfoA", lpStartupInfo)
End Sub

Function OpenProcess(dwDesiredAccess, bInheritHandle, dwProcessId)
  ' Declare Function OpenProcess Lib "kernel32" Alias "OpenProcess" _
  '   (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
  OpenProcess = oATO.CallAPI("KERNEL32.DLL", "OpenProcess", dwDesiredAccess, bInheritHandle, dwProcessId)
End Function


Function GetCurrentProcess()
  ' Declare Function GetCurrentProcess Lib "kernel32" Alias "GetCurrentProcess" () As Long
  GetCurrentProcess = oATO.CallAPI("KERNEL32.DLL", "GetCurrentProcess")
End Function

Function GetCurrentProcessId()
  ' Declare Function GetCurrentProcessId Lib "kernel32" Alias "GetCurrentProcessId" () As Long
  GetCurrentProcessId = oATO.CallAPI("KERNEL32.DLL", "GetCurrentProcessId")
End Function

Function GetModuleFileName(hModule, lpFileName, nSize)
  ' Declare Function GetModuleFileName Lib "KERNEL32" Alias _
  '   "GetModuleFileNameA" (ByVal hModule As Long, ByVal lpFileName As String, _
  '   ByVal nSize As Long) As Long
  GetModuleFileName = oATO.CallAPI("KERNEL32.DLL", "GetModuleFileNameA", _
      hModule, lpFileName, nSize)
End Function



Function GetClassName(hWnd, lpClassName, nMaxCount)
  ' Declare Function GetClassName Lib "user32" Alias "GetClassNameA" _
  '   (ByVal hWnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
  GetClassName = oATO.CallAPI("USER32.DLL", "GetClassNameA", hWnd, lpClassName, nMaxCount)
End Function



Sub CopyMemory(lpDest, lpSrc, cBytes)
Const sMe = "[CopyMemory Api Call], "

  ' do some extra parameter checking here,
  '   as CopyMemory is about as risky as it gets...
  BugAssert (VarType(lpDest) = vbLong), sMe & "adrDest must a Long"
  BugAssert (VarType(lpSrc) = vbLong), sMe & "adrSrc must a Long"
  BugAssert (VarType(cBytes) = vbInteger), sMe & "cBytes must an Integer"

  ' Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
  '   (Destination As Any, Source As Any, ByVal Length As Long)
  oATO.CallAPI "KERNEL32.DLL", "RtlMoveMemory", lpDest, lpSrc, cBytes
End Sub

Function GetParent(hWnd)
  ' Declare Function GetParent Lib "user32" Alias "GetParent" _
  '   (ByVal hWnd As Long) As Long
  GetParent = oATO.CallAPI("USER32.DLL", "GetParent", hWnd)
End Function

Function CloseHandle(hObject)
  ' Declare Function CloseHandle Lib "kernel32" Alias "CloseHandle" _
  '   (ByVal hObject As Long) As Long
  CloseHandle = oATO.CallAPI("KERNEL32.DLL", "CloseHandle", hObject)
End Function

Function UnmapViewOfFile(lpBaseAddress)
  ' Declare Function UnmapViewOfFile Lib "kernel32" Alias "UnmapViewOfFile" _
  '   (lpBaseAddress As Any) As Long
  UnmapViewOfFile = oATO.CallAPI("KERNEL32.DLL", "UnmapViewOfFile", lpBaseAddress)
End Function

Function MapViewOfFile(hFileMappingObject, dwDesiredAccess, dwFileOffsetHigh, _
  dwFileOffsetLow, dwNumberOfBytesToMap)
  ' Declare Function MapViewOfFile Lib "kernel32" Alias "MapViewOfFile" _
  '   (ByVal hFileMappingObject As Long, ByVal dwDesiredAccess As Long, _
  '   ByVal dwFileOffsetHigh As Long, ByVal dwFileOffsetLow As Long, _
  '   ByVal dwNumberOfBytesToMap As Long) As Long
  MapViewOfFile = oATO.CallAPI("KERNEL32.DLL", "MapViewOfFile", _
      hFileMappingObject, dwDesiredAccess, dwFileOffsetHigh, _
      dwFileOffsetLow, dwNumberOfBytesToMap)
End Function

Function CreateFileMapping(hFile, lpFileMappigAttributes, flProtect, dwMaximumSizeHigh, _
  dwMaximumSizeLow, lpName)
  ' Declare Function CreateFileMapping Lib "kernel32" Alias "CreateFileMappingA" _
  '   (ByVal hFile As Long, lpFileMappigAttributes As SECURITY_ATTRIBUTES, _
  '   ByVal flProtect As Long, ByVal dwMaximumSizeHigh As Long, _
  '   ByVal dwMaximumSizeLow As Long, ByVal lpName As String) As Long
  CreateFileMapping = oATO.CallAPI("KERNEL32.DLL", "CreateFileMappingA", _
      hFile, lpFileMappigAttributes, flProtect, dwMaximumSizeHigh, _
      dwMaximumSizeLow, lpName)
End Function

Function FindWindowEx(hWndParent, hWndChildAfter, lpClassName, lpWindowName)
  ' Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
  ' (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
  FindWindowEx = oATO.CallAPI("USER32.DLL", "FindWindowExA", _
      hWndParent, hWndChildAfter, lpClassName, lpWindowName)
End Function


Function EnumDisplaySettings(lpszDeviceName, iModeNum, lpDevMode)
  ' Declare Function EnumDisplaySettings Lib "user32" Alias "EnumDisplaySettingsA" _
  '   (ByVal lpszDeviceName As Long, ByVal iModeNum As Long, _
  '   lpDevMode As Any) As Boolean
  EnumDisplaySettings = oATO.CallAPI("USER32.DLL", "EnumDisplaySettingsA", _
      lpszDeviceName, iModeNum, lpDevMode)
End Function

Function ChangeDisplaySettings(lpDevMode, dwFlags)
  ' Declare Function ChangeDisplaySettings Lib "user32" Alias "ChangeDisplaySettingsA" _
  '  (lpDevMode As Any, ByVal dwflags As Long) As Long
  ChangeDisplaySettings = oATO.CallAPI("USER32.DLL", "ChangeDisplaySettingsA", _
      lpDevMode, dwFlags)
End Function




Function BlockInput(bFlag)
  BlockInput = oATO.CallAPI("USER32.DLL", "BlockInput", bFlag)
End Function


' ------------------------------------------------
' --- KERNEL32.DLL -------------------------------
' ------------------------------------------------


Function Process32Next(hObject, lpPROCESSENTRY32)
  ' Declare Function Process32Next Lib "kernel32" _
  '   (ByVal hObject As Long, p As PROCESSENTRY32) As Boolean
  Process32Next = oATO.CallAPI("KERNEL32.DLL", "Process32Next", _
      hObject, lpPROCESSENTRY32)
End Function

Function Process32First(hObject, lpPROCESSENTRY32)
  ' Declare Function Process32First Lib "kernel32" _
  '   (ByVal hObject As Long, p As PROCESSENTRY32) As Boolean
  Process32First = oATO.CallAPI("KERNEL32.DLL", "Process32First", _
      hObject, lpPROCESSENTRY32)
End Function

Function CreateToolhelp32Snapshot(dwFlags, th32ProcessID)
  ' Declare Function CreateToolhelp32Snapshot Lib "kernel32" _
  '   (ByVal dwFlags As Long, ByVal dwProcessID As Long) As Long
  '
  ' The th32ProcessID argument is only used if TH32CS_SNAPHEAPLIST or
  ' TH32CS_SNAPMODULE is specified. th32ProcessID == 0 means the current
  ' process.  (I think Bruce meant the entire current process list, jw)
  '
  ' note: all of the snapshots are global except for the heap and module
  '   lists which are process specific. To enumerate the heap or module
  '   state for all WIN32 processes call with TH32CS_SNAPALL and the
  '   current process. Then for each process in the TH32CS_SNAPPROCESS
  '   list that isn't the current process, do a call with just
  '   TH32CS_SNAPHEAPLIST and/or TH32CS_SNAPMODULE.
  '
  CreateToolhelp32Snapshot = oATO.CallAPI("KERNEL32.DLL", "CreateToolhelp32Snapshot", _
      dwFlags, th32ProcessID)
End Function



Function GetUserDefaultLCID()
  ' Declare Function GetUserDefaultLCID Lib "kernel32" () As Long
  GetUserDefaultLCID = oATO.CallAPI("KERNEL32.DLL", "GetUserDefaultLCID")
End Function

Function GetLocaleInfo(Locale, LCType, lpLCData, cchData)
  ' Declare Function GetLocaleInfo Lib "kernel32" Alias "GetLocaleInfoA" _
  ' (ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String, _
  ' ByVal cchData As Long) As Long
  GetLocaleInfo = oATO.CallAPI("KERNEL32.DLL", "GetLocaleInfoA", _
    Locale, LCType, lpLCData, cchData)
End Function




' ------------------------------------------------
' --- GDI32.DLL ----------------------------------
' ------------------------------------------------


Function CreatePen(nPenStyle, nWidth, crColor)
  ' Declare Function CreatePen Lib "gdi32" Alias "CreatePen" _
  '   (ByVal nPenStyle As Long, ByVal nWidth As Long, ByVal crColor As Long) As Long
  CreatePen = oATO.CallAPI("GDI32.DLL", "CreatePen", nPenStyle, nWidth, crColor)
End Function

Function CreateSolidBrush(crColor)
  ' Declare Function CreateSolidBrush Lib "gdi32" Alias "CreateSolidBrush" _
  '   (ByVal crColor As Long) As Long
  CreateSolidBrush = oATO.CallAPI("GDI32.DLL", "CreateSolidBrush", crColor)
End Function

Function CreateCompatibleBitmap(hDC, nWidth, nHeight)
Dim hBmp  ' as long
  hBmp = oATO.CallAPI("GDI32.DLL", "CreateCompatibleBitmap", hDC, nWidth, nHeight)
    BugAssert (hBmp <> 0), " could not create compatible bitmap"
  ' the bmp handle is valid, so proceed...
  CreateCompatibleBitmap = hBmp
End Function

Function CreateCompatibleDC(hDC)
Dim hDCMem  ' as long
  hDCMem = oATO.CallAPI("GDI32.DLL", "CreateCompatibleDC", hDC)
    BugAssert (hDCMem <> 0), " could not create compatible dc"
  ' the dc handle is valid, so proceed...
  CreateCompatibleDC = hDCMem
End Function


Function RoundRect(hDC, X1, Y1, X2, Y2, X3, Y3)
Dim nRtn  ' as long
  ' Declare Function RoundRect Lib "gdi32" Alias "RoundRect" _
  '   (ByVal hDC As Long, ByVal X1 As Long, ByVal Y1 As Long, _
  '   ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
  ' ----------------------------------------------
  ' Note: X3,Y3 are the (outside) width,height of an ELLIPSE used to
  '   round the corners.  So, if you want a 5 pixel RADIUS, X3,Y3 would be 10,10.
  ' ----------------------------------------------
  nRtn = oATO.CallAPI("GDI32.DLL", "RoundRect", hDC, X1, Y1, X2, Y2, X3, Y3)
    BugAssert (nRtn <> 0), " .. RoundRect returned an error"
  RoundRect = nRtn
End Function

Function Rectangle(hDC, X1, Y1, X2, Y2)
Dim nRtn  ' as long
  nRtn = oATO.CallAPI("GDI32.DLL", "Rectangle", hDC, X1, Y1, X2, Y2)
    BugAssert (nRtn <> 0), " .. Rectangle returned an error"
  Rectangle = nRtn
End Function


Function Pie(hDC, X1, Y1, X2, Y2, X3, Y3, X4, Y4)
Dim nRtn  ' as long
  nRtn = oATO.CallAPI("GDI32.DLL", "Pie", hDC, X1, Y1, X2, Y2, X3, Y3, X4, Y4)
    BugAssert (nRtn <> 0), " .. Pie returned an error!"
  Pie = nRtn
End Function

Function SetBkMode(hDC, nBkMode)
  ' Declare Function SetBkMode Lib "gdi32" Alias "SetBkMode" _
  '   (ByVal hDC As Long, ByVal nBkMode As Long) As Long
  SetBkMode = oATO.CallAPI("GDI32.DLL", "SetBkMode", hDC, nBkMode)
End Function

Function ChooseColor(tCC)
  ' Declare Function ChooseColor Lib "comdlg32.dll" Alias "ChooseColorA" _
  ' (pChoosecolor As CHOOSECOLOR) As Long
  ChooseColor = oATO.CallAPI("COMDLG32.DLL", "ChooseColorA", tCC)
End Function



Function SetTextCharacterExtra(hDC, nCharExtra)
  ' Declare Function SetTextCharacterExtra Lib "gdi32" Alias "SetTextCharacterExtra" _
  '   (ByVal hDC As Long, ByVal nCharExtra As Long) As Long
  SetTextCharacterExtra = oATO.CallAPI("GDI32.DLL", "SetTextCharacterExtra", hDC, nCharExtra)
End Function


Function GetDeviceCaps(hDC, nIndex)
  ' Declare Function GetDeviceCaps Lib "gdi32" Alias "GetDeviceCaps" _
  '   (ByVal hDC As Long, ByVal nIndex As Long) As Long
  GetDeviceCaps = oATO.CallAPI("GDI32.DLL", "GetDeviceCaps", hDC, nIndex)
End Function

Function EndDoc(hDC)
  ' Declare Function EndDoc Lib "gdi32" Alias "EndDoc" _
  '   (ByVal hDC As Long) As Long
  EndDoc = oATO.CallAPI("GDI32.DLL", "EndDoc", hDC)
End Function

Function EndPage(hDC)
  ' Declare Function EndPage Lib "gdi32" Alias "EndPage" _
  '   (ByVal hDC As Long) As Long
  EndPage = oATO.CallAPI("GDI32.DLL", "EndPage", hDC)
End Function

Function CreateFont(Ht, Wd, Esc, Ornt, Wt, It, Ul, SO, CS, OP, CP, Qual, PAF, sFace)
  ' Declare Function CreateFont Lib "gdi32" Alias "CreateFontA" _
  '   (ByVal H As Long, ByVal W As Long, ByVal E As Long, ByVal O As Long, _
  '   ByVal W As Long, ByVal I As Long, ByVal u As Long, ByVal S As Long, _
  '   ByVal C As Long, ByVal OP As Long, ByVal CP As Long, ByVal Q As Long, _
  '   ByVal PAF As Long, ByVal F As String) As Long
  CreateFont = oATO.CallAPI("GDI32.DLL", "CreateFontA", _
    Ht, Wd, Esc, Ornt, Wt, It, Ul, SO, CS, OP, CP, Qual, PAF, sFace)
End Function

Function TextOut(hDC, x, y, sText, cCount)
  ' Declare Function TextOut Lib "gdi32" Alias "TextOutA" _
  '   (ByVal hDC As Long, ByVal x As Long, ByVal y As Long, _
  '   ByVal lpString As String, ByVal nCount As Long) As Long
  TextOut = oATO.CallAPI("GDI32.DLL", "TextOutA", hDC, x, y, sText, cCount)
End Function

Function SelectObject(hDC, hObject)
  ' Declare Function SelectObject Lib "gdi32" Alias "SelectObject" _
  '   (ByVal hDC As Long, ByVal hObject As Long) As Long
  SelectObject = oATO.CallAPI("GDI32.DLL", "SelectObject", hDC, hObject)
End Function

Function StartPage(hDC)
  ' Declare Function StartPage Lib "gdi32" Alias "StartPage" _
  '   (ByVal hDC As Long) As Long
  StartPage = oATO.CallAPI("GDI32.DLL", "StartPage", hDC)
End Function

Function SetMapMode(hDC, nMapMode)
  ' Declare Function SetMapMode Lib "gdi32" Alias "SetMapMode" _
  '   (ByVal hDC As Long, ByVal nMapMode As Long) As Long
  SetMapMode = oATO.CallAPI("GDI32.DLL", "SetMapMode", hDC, nMapMode)
End Function

Function StartDoc(hDC, lpDOCINFO)
  ' Declare Function StartDoc Lib "gdi32" Alias "StartDocA" _
  '   (ByVal hDC As Long, lpdi As DOCINFO) As Long
  StartDoc = oATO.CallAPI("GDI32.DLL", "StartDocA", hDC, lpDOCINFO)
End Function

Function RestoreDC(hDC, hSaveDC)
  ' Declare Function RestoreDC Lib "gdi32" Alias "RestoreDC" _
  '   (ByVal hDC As Long, ByVal hSaveDC As Long) As Long
  RestoreDC = oATO.CallAPI("GDI32.DLL", "RestoreDC", hDC, hSaveDC)
End Function

Function SaveDC(hDC)
  ' Declare Function SaveDC Lib "gdi32" Alias "SaveDC" (ByVal hDC As Long) As Long
  SaveDC = oATO.CallAPI("GDI32.DLL", "SaveDC", hDC)
End Function

Function DeleteDC(hDC)
  ' Declare Function DeleteDC Lib "gdi32" Alias "DeleteDC" _
  '   (ByVal hDC As Long) As Long
  DeleteDC = oATO.CallAPI("GDI32.DLL", "DeleteDC", hDC)
End Function

Function CreateDC(sDriverName, sDeviceName, sOutput, lpInitData)
  ' Declare Function CreateDC Lib "gdi32" Alias "CreateDCA" _
  '   (ByVal lpDriverName As String, ByVal lpDeviceName As String, _
  '   ByVal lpOutput As String, lpInitData As DEVMODE) As Long
  CreateDC = oATO.CallAPI("GDI32.DLL", "CreateDCA", _
      sDriverName, sDeviceName, sOutput, lpInitData)
End Function

Function ClosePrinter(hPrinter)
  ' Declare Function ClosePrinter Lib "winspool.drv" Alias "ClosePrinter" _
  '   (ByVal hPrinter As Long) As Long
  ClosePrinter = oATO.CallAPI("WINSPOOL.DRV", "ClosePrinter", hPrinter)
End Function

Function OpenPrinter(sPrinterName, hPrinter, tPrnDefs)
  'Declare Function OpenPrinter Lib "winspool.drv" Alias "OpenPrinterA" _
  '   (ByVal pPrinterName As String, phPrinter As Long, pDefault As PRINTER_DEFAULTS) As Long
  OpenPrinter = oATO.CallAPI("WINSPOOL.DRV", "OpenPrinterA", _
      sPrinterName, hPrinter, tPrnDefs)
End Function

Function GetProfileString(sAppName, sKeyName, sDefault, sReturnedString, nSize)
  ' Declare Function GetProfileString Lib "kernel32" Alias "GetProfileStringA" _
  '   (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpDefault As String, _
  '   ByVal lpReturnedString As String, ByVal nSize As Long) As Long
  GetProfileString = oATO.CallAPI("KERNEL32.DLL", "GetProfileStringA", _
    sAppName, sKeyName, sDefault, sReturnedString, nSize)
End Function

Sub BugAssert (bTest, sErrMsg)
Dim sDblSpace : sDblSpace = vbCrLf & vbCrLf

  ' BugAssert is a Bruce McKinney creation.
  '   It is used to test for intermediate results...

  if  bTest  then  Exit Sub  ' normally (hopefully) test returns true...

  MsgBox "Error Message reported by BugAssert: " & sDblSpace _
    & sErrMsg & sDblSpace & "    this script will terminate NOW. ", _
    vbCritical, " << BugAssert FAILED in Script: " & Wscript.ScriptName & " >> "
  WScript.Quit

End Sub
]]>
    </script>
    </component>
</package>

http://www.myclanhosting.com/defiasVisit Join and contribute to a soon to be leader in Custumized tools development in [C# .Net 1.1 ~ 2.0/C/C++/MFC/AutoIt3/Masm32]

Share this post


Link to post
Share on other sites



this is a wsc that uses wshATO(wshAPIToolkitObject) to access API through WSH and uses VB to convert VARIANTs to acctual data types.. but anyway i had a idea about creating a Shell cmdline that is attachable to processes and can excute dllinjection : maybe a lil memory editing and so forth but alls i have atm is vbs as i have yet to master autoit in the 3 days ive had it... but I love it... Its So much like PERL its extremely fasinating to see the alll out development of every lvl of this language and see the results of hard community Work put to Good use in beta versions.. 

this tool will be like a scriptomatic but For windows API / and from what ive seen of peek and Poke

<?XML version="1.0" standalone="yes" encoding="UTF-16" ?>
...

<{POST_SNAPBACK}>

Tell me if I get this wrong, but that whole script can easily be implemented in AutoIt using DLLCall() and DLLStruct commands. No need for VBScript.

Or isn't that your question?

-Sven

Share this post


Link to post
Share on other sites

its not a question it's a proposal for a idea that use COM +Win32 API it will also haveto get degug priveldges so on so forth but what um asking is that if u can translate it to auto it and i will add a lil more ingenuity i believe i will have a viable tool Extension To AutoIT3 beta as said in the DllCall section it would be easiear to write a type def with coomma instead of with "" or w/e and i say it would be even easier if we didnt have to open the dll, instead i propese we just call the function with the opening of the desired Dll in the function area and and just pass the data to the function in the for of arguments/or statement or structures.. ok so how i propose this is by wrapping every api call in a function and exposings its properties and methods useing ObjCreate we would then simply instaniate Include Constants and Structures and then WE are done... so its alot of work and might not bear fruit for sometime but if anyone has suggestions and greatly valued input pls ask and i will try yo explain

7 yrs of vbs 5 yrs of wsh/wsf/wsc 3 yrs PERL 3 days Of AutoIt3 im Global HookED :/

i think this would add even Greater functionality once ppl understood it and started Combining API Calls with internal Functionality


http://www.myclanhosting.com/defiasVisit Join and contribute to a soon to be leader in Custumized tools development in [C# .Net 1.1 ~ 2.0/C/C++/MFC/AutoIt3/Masm32]

Share this post


Link to post
Share on other sites

I see what you are saying, and it might be nice, but there are several issues:

  • There are a couple thousand API function calls and hundreds of structures.
  • Of these thousands of API calls, not all are available on all platforms. A system must be created so that functions that don't exist on older platforms don't crash but some sort of error needs raised because the function won't be call-able.
  • COM is slow compared to working with memory directly.
  • The size of such a project would be huge simply because of the size of the Windows API.
It would be an amitious project, to say the least. But I'm not sure if the results would justify the effort. Its far simpler for most people to use DllCall() than it would be to pack around a COM server (DLL) with their scripts, install it on the target machine, register it, run the script and then in the case of not being able to leave a trace on the machine, they have to unregister it (Pray during this time that it doesn't leave orphaned information in the registry like a lot of COM objects do), and then finally delete the DLL and itself.

And if you were implying to build this COM object directly into AutoIt's executable, no chance in hell. It would be massive.

Share this post


Link to post
Share on other sites

i hear u there.. it would be massive but i think u missed its functionality.. i wouldnt installit on a remote machine nor Build it into Au3 source it would be like Cheat engine or t-Search BuT with Olly's Capabilities. and instead of Registering anything manuely i can Force register Dll's or set it with its own Working Directory :) there is alot off dlls ppl have in Common Kernal32 user32 its just the version of the Dll that is different but that can usually be rectified. i seriosly doubt this idea but maybe a remote Dll Lib can be imported into auto it with like a #RemInclude witch has the Dll's that we have listed and documented so that no discrepincies arise from version hell :evil: but that just a idea id have no idea how to implement a remote include ..


http://www.myclanhosting.com/defiasVisit Join and contribute to a soon to be leader in Custumized tools development in [C# .Net 1.1 ~ 2.0/C/C++/MFC/AutoIt3/Masm32]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0