Delphi Basics Snippets Archive: Archive: Delphi Basics Snippets
Delphi Basics Snippets
This unit has been coded to facilitate simple use of the otherwise advanced "Func In" technique.
Functions can be written normally. This version also supports:
+ Static strings
+ Functions calls
Respective Server Example:
Only delphi source code is included in the archive.
This Unit is Made by Snify and MindfreaK together.
We went bored and searched for an x64 persistence method.
U can easily write your own x64 persistence with this ,
just write ur persistence dll or codeinjection and inject it
into an process u have found with GetInjectAbleProcess.
WARNING: Remember, the Process is chosen randomly and could be terminated
by itself , so u need an re-inject system which checks for an running
persistence module/dll/codeinjection. ( TIPP: Communicate via Mutex )
Inspired by Small Applications in Delphi - Tutorial by n0v4, these "Mini-Delphi" units (identification by PEiD) have been updated to work with all Windows NT operating systems.
To apply a nice glass effect to our console applications we must use the DwmEnableBlurBehindWindow function (Only available in Windows Vista and Windows 7).
Author: Rodrigo Ruz
To detect if Aero Glass is enabled we must use the DwmIsCompositionEnabled function.
Author: Rodrigo Ruz
The native API NtDeleteFile performs the same task as the user-mode API DeleteFile, but interestingly enough, the user-mode API does not call the native API to perform it’s task. As explained here, normally files are deleted through calls to NtSetInformationFile. The main difference in behavior comes from the fact that NtDeleteFile does not wait for handles on the file to close before deleting it (note that if the file is “open for normal I/O or as a memory-mapped file”, it still can’t be deleted, so only read-only handles will be ignored).
The required structures (not defined in Delphi) are:
The steps to remove the file are:
Using the afore-linked-to type definitions, we still need to import the native APIs:
Do note that this statically links the imported functions, making the whole application unable to load if the undocumented APIs are not present on the system (at least for Windows 2000 and XP they should be).
Converting the DOS path name to a native path is done by the RtlDosPathNameToNtPathName_U API, which takes in a PWChar argument containing the DOS path and a pre-allocated UNICODE_STRING structure of MAX_PATH WideChars and returns True if it has successfully converted the path.
There are lots of neat little things that are in many of the DLLs that Microsoft has installed in Windows. Most of them are documented in the Win32 API. However, there are a lot of them that are undocumented. This article shows how to use one of the undocumented functions available in user32.dll, MessageBoxTimeOut.
This type of functionality for a MessageBox has been requested on the Delphi newsgroups many times and there have been several solutions written. After being introduced in XP, this functionality is now available to developers using this undocumented API.
Since this function is not documented, it is not found in Windows.pas, so it has to be defined. It is identical to the MessageBox API definition except it has two more parameters, wLanguageID and dmMilliseconds.
Now, to call the function, it is as easy as setting the flags and making the call. There may be other results returned that I am not aware of besides the standard IDxxx return values and the MB_TIMEDOUT result defined above.
I presume Borland will not put this into Windows.pas until Microsoft documents it but developers can get a head start on them by using the code above. It is unlikely that Microsoft will depricate this function for quite some time because all of the standard MessageBox API calls actually call MessageBoxTimeOutA or MessageBoxTimeoutW and pass $FFFFFFFF as the timeout period meaning the dialog will wait a very long time, approx 49 days!
"Just got inspired last night and decided to start a class to get the screen in "blocks" and check which one has changed to update only those."
Basically this project does this:
Gets a snapshot of the screen;
Saves it in a matrix 8x8;
Updates the blocks that changes;
Shows the blocks in a reduced size to fit the form (about 2/3 of your resolution, but that is just me playing around).
So far I have done few tests. In a 1920x1080 and 3 secs update rate resolution considering compression capacity of 15%, gives me about 2~8kb/s for "small changes" in the screen. Of course that if the entire screen changes there are peaks. I found peaks of 400kb/s.
Only Delphi source code is included in the archive.
This short delphi snippet details dynamically calling windows apis with encryption.
1-10 of 181