vb system programming in practice
TRANSCRIPT
-
8/14/2019 VB System Programming in Practice
1/10
1
VB system programming inVB system programming in
PracticePractice
ByBy
Gouri VGouri V
-
8/14/2019 VB System Programming in Practice
2/10
2
Introduction to APIIntroduction to API
VB - A Serious windows developmentVB - A Serious windows developmenttooltool
What are Windows APIs?What are Windows APIs?Simple VB API ExampleSimple VB API ExampleStatic and Dynamic linkingStatic and Dynamic linking
What is a DLL?What is a DLL?
-
8/14/2019 VB System Programming in Practice
3/10
3
API declaration and syntax-API declaration and syntax-
[Public | Private] Declare Sub|Function[Public | Private] Declare Sub|Functionname Lib libname Alias aliasname]name Lib libname Alias aliasname][([arglist])] [As type][([arglist])] [As type]
Ex.Ex.
Public Declare Function GetTickCount _Public Declare Function GetTickCount _Lib "kernel32.dll" () As LongLib "kernel32.dll" () As Long
Where does system locates a DLL?Where does system locates a DLL?
DLL disadvantagesDLL disadvantages Right choice A design issue in analysisRight choice A design issue in analysis
phase.phase.
-
8/14/2019 VB System Programming in Practice
4/10
4
Some classic fundas to followSome classic fundas to follow
using APIusing API Using the Any keywordUsing the Any keyword
Declare Sub CopyMemory Lib kernel32 _Declare Sub CopyMemory Lib kernel32 _
Alias RtlMoveMemory (lpvDest As Any, _Alias RtlMoveMemory (lpvDest As Any, _lpvSource As any, ByVal cbCopy As Long)lpvSource As any, ByVal cbCopy As Long)
UDTs and API callsUDTs and API callsPrivate Declare Sub GlobalMemoryStatus _Private Declare Sub GlobalMemoryStatus _
Lib "kernel32" (lpBuffer As MEMORYSTATUS)Lib "kernel32" (lpBuffer As MEMORYSTATUS)
Currency VariablesCurrency Variables Window HandlesWindow Handles Boolean Return ValuesBoolean Return Values Limitations of VB to use WIN32 APIsLimitations of VB to use WIN32 APIs
-
8/14/2019 VB System Programming in Practice
5/10
5
Exploring WIN32 APIExploring WIN32 API
Lets begin to exploreLets begin to explore Kernel32.dll, user32.dll, gdi32.dllKernel32.dll, user32.dll, gdi32.dll Kernel32 overviewKernel32 overview
Memory managementMemory management MultithreadingMultithreading File operationsFile operations Process controlProcess control
Kill running Spyware by Process controlKill running Spyware by Process control CreateToolhelp32Snapshot - Takes a snapshot of theCreateToolhelp32Snapshot - Takes a snapshot of the
processes and the heaps, modules, and threads used by theprocesses and the heaps, modules, and threads used by theprocesses; returns handle to snapshot.processes; returns handle to snapshot. Process32First - Retrieves information about the first processProcess32First - Retrieves information about the first process
encountered in a system snapshot.encountered in a system snapshot. Process32Next - Retrieves information about the next processProcess32Next - Retrieves information about the next process
recorded in a system snapshot.recorded in a system snapshot.
-
8/14/2019 VB System Programming in Practice
6/10
6
Test Previous instance of Appliaction byTest Previous instance of Appliaction byCreateMutexCreateMutex
Public Declare Function CreateMutex _Public Declare Function CreateMutex _
Lib "kernel32.dll" _Lib "kernel32.dll" _
Alias "CreateMutexA" (lpMutexAttributes As Any, _Alias "CreateMutexA" (lpMutexAttributes As Any, _
ByVal bInitialOwner As Boolean, _ByVal bInitialOwner As Boolean, _
ByVal lpName As String) As LongByVal lpName As String) As Long
Save, save and save your work often!Save, save and save your work often!
-
8/14/2019 VB System Programming in Practice
7/107
User32 Calls and Gdi32 CallsUser32 Calls and Gdi32 Calls
User32.dll is primarily responsible for, but notUser32.dll is primarily responsible for, but notlimited to:limited to: Windows ManagementWindows Management MenusMenus ControlsControls
Win32 HandlesWin32 Handles
Gdi32.dll call are primarily responsible for, butGdi32.dll call are primarily responsible for, butnot limited to, graphical manipulations.not limited to, graphical manipulations. Windows MessagesWindows Messages SubclassingSubclassing
-
8/14/2019 VB System Programming in Practice
8/108
More interesting about windowsMore interesting about windows
messagesmessages
WindowWindowProceduresProcedures
Window ClassesWindow Classes Queued MessagesQueued Messages Message LoopsMessage Loops
Nonqueued MessagesNonqueued Messages
-
8/14/2019 VB System Programming in Practice
9/10
9
Real time system utilities andReal time system utilities and
challengeschallenges Remove invalid file extensionsRemove invalid file extensions Find out and remove Spywares on your PCFind out and remove Spywares on your PC Make your PC junk freeMake your PC junk free Remove missing softwaresRemove missing softwares Delete malicious startup entriesDelete malicious startup entries Scanning cookiesScanning cookies
-
8/14/2019 VB System Programming in Practice
10/10
10
??
Thanks!!Thanks!!