Windows Services & Other Stuff

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
JHPJHP
Addict
Addict
Posts: 1853
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Windows Services & Other Stuff

Post by JHPJHP »

-----------------------------------------------------------------------------------

Download Windows Services & Other Stuff from My PureBasic Stuff

-----------------------------------------------------------------------------------

Announcements
PureBasic Interface to OpenCV
PureBasic Interface to WinDivert
PureBasic Interface to WinRAR
PureBasic Interface to 7-Zip
PureBasic Interface to ImDisk
Windows Services & Other Stuff
Invading Space Aliens
Death Star vs Asteroids
GIF Toolkit
LSB Image Steganography
Spider Web Drawing
Deform Image: MLS
Video Snipping Tool
Chromium Edge WebGadget
IAccessible Interface
Stitch Images: SIFT
OldSkool Fire Effect
Image Waves: LUT
YouTube Player & Downloader
MP4 Player & Downloader
Large Image Viewer
Barcode Generator
Google Translate Service
Embed JS into PureBasic
Geolocation: Google Maps
Book & Viewer & Magnify
Video for Windows: VfW
Alternate Console
Network Share Management

-----------------------------------------------------------------------------------

WINDOWS SERVICES
- includes\WindowsServices.pbi (ServiceStatusEnum, ServiceCreate, ServiceDelete, ServiceStatus, ServiceStartup, ServiceStart, ServiceStop)
- binaries\ServiceWindow_EXE.pb, ServiceWindow.exe: example program run as a service
- binaries\AddNewService_EXE.pb, AddNewService.exe: example service used to execute ServiceWindow.exe
- CreateService.pb: example to create a service
- StartStopService.pb: example to stop then start a service

-----------------------------------------------------------------------------------

OTHER STUFF
- AESEncryption\AES_CipherBuffer.pb, AES_EncoderDecoder.pb
- AlternateDataStream\ADS.pb
- AnimatedGIF\MovableSpriteObject.pb, UseGIFImageDecoder.pb, UseGIFImageDecoder_Memory.pb, WebGadgetGIF.pb
- BrowserCache\CacheChrome.pb, CacheEdge.pb, CacheExplorer.pb

- ColorConversion\
-- Convert\ConvertCIELAB.pb, ConvertCIELUV.pb, ConvertGrayscale.pb, ConvertHLS.pb, ConvertHSV.pb, ConvertHunterLAB.pb, ConvertNegative.pb,
-- ConvertSepia.pb, ConvertXYZ.pb, ConvertYIQ.pb, ConvertYUV.pb
-- Lode\HSLtoRGB.pb, HSVtoRGB.pb, RGBtoHSL.pb, RGBtoHSV.pb
-- Various\HSLtoRGB.pb, HSVtoRGB.pb

- CommonItemDialog\OpenFolderRequester.pb

- CopyShare\
-- CopyData\Text_Receive.pb, Text_Send.pb
-- ShareMemory\Image\1. Send.pb, 2. Receive.pb
-- ShareMemory\Text\1. Send.pb, 2. Receive.pb

- CriticalFlag\CriticalFlag.pb
- DigitalClock\DigitalClock.pb
- FileDates\FileDates.pb
- FileFingerprint\FileFingerprint.pb
- FolderSize\FolderSize.pb
- FontStuff\AddFontResourceEx.pb, EnumerateSystemFonts.pb, FindFontFile.pb, FontStuffFromFile_1.pb, FontStuffFromFile_2.pb, GetFontInformation.pb
- GadgetBar\GadgetBar.pb

- GadgetStuff\Reset_Window.pb, TreeGadget_Sync.pb
-- CanvasGadget\CanvasImageButton_1.pb, CanvasImageButton_2.pb
-- ListIconGadget\MoveMultipleItems.pb, MultiLineImage.pb
-- WebGadget\AudioInfo1.pb, AudioInfo2.pb, Element_With_ID.pb, Elements_Without_ID.pb, ImageInfo.pb, IWebBrowser2.pb, MarqueeText_1.pb,
-- MarqueeText_2.pb, MarqueeText_3.pb, MarqueeText_4.pb, NoScroll.pb, ProxyServer.pb, UserAgent.pb, VideoInfo.pb

- GetUsage\GetUsage.pb
- GoogleTranslate\GoogleTranslate.pb, GoogleTranslate_DLL.pb

- HideVideo\
-- AlternateDataStream\CreateADS.pb, ExtractADS.pb
-- DataSection\DataSection.pbi, PlayVideo.pb

- ImageWindow\ImageWindow.pb
- InflateDeflate\InflateDeflate.pb

- ISAPI\ISAPI_Test.pb
-- binaries\ISAPI_Test_32.dll, ISAPI_Test_64.dll
-- includes\ISAPI.pbi
-- references\HttpExt.h

- ManifestResource\SetManifest.pb
- MemoryFolder\MemoryFolder.pb

- MonitorStuff\ChangeDisplayOrientation.pb, ChangeDisplaySettingsEx.pb, GetAutoRotationState.pb, GetMonitorInfo.pb,
- PhysicalToLogicalPointForPerMonitorDPI.pb, SetDpiAwareness.pb, WindowsDpiStuff.pb
-- SetDisplayConfig\SetDisplayConfig.pb

- MountImage\MountImage.pb
- Odometer\Odometer.pb
- OldSkoolEffects\Cloud_Effect.pb, Fire_Effect_1.pb, Fire_Effect_2.pb, Julia_Effect.pb, Mandelbrot_Effect.pb, Plasma_Effect.pb,
- Tree_Effect.pb, Tunnel_Effect.pb

- OpenGLStuff\
-- RotateDice\RotateDice.pb

- OtherStuff\
-- AccessibleObjectFromEvent\AccessibleObjectFromEvent.pb
-- AccessibleObjectFromPoint\AccessibleObjectFromPoint.pb
-- AccessibleObjectFromWindow\AccessibleObjectFromWindow.pb
-- CommandConsole\ReadOutput.pb, RunScript.pb
-- GetProgramData\GetProgramData.pb
-- RegisterShellHookWindow\RegisterShellHookWindow_1.pb, RegisterShellHookWindow_2.pb
-- SetWindowsHookEx\SetWindowsHookEx.pb, SetWindowsHookEx_DLL.pb
-- SetWinEventHook_1\SetWinEventHook.pb
-- SetWinEventHook_2\SetWinEventHook.pb
-- TransparentWindow\TransparentWindow_1.pb, TransparentWindow_2.pb, TransparentWindow_3.pb
-- WindowsMagnification\WindowsMagnificationAPI.pb
-- Base64DataSection.pb, Base64ImagePB.pb, BringWindowToTop.pb, CompressUncompress.pb, ConnectUNC.pb, CryptQueryObject.pb, DisableClose.pb,
-- EnumerateWindows.pb, FlipTest.pb, FormatDevice.pb, GetExternalIP.pb, GetFileVersion.pb, GetProductKey.pb, GlobalKeyboardHook.pb,
-- GlobalMouseHook.pb, Grayscale.pb, IsOS64Bit.pb, MapDrive.pb, PlotCurve.pb, Power2Bitwise.pb, RecordMic.pb, FileSecurity.pb, SetProgressState.pb,
-- TimedMessageBox.pb

- PowerShell\SendHtmlEmail.pb
-- Image2Base64\Image2Base64.pb
-- PNGImage2Icon\PNGImage2Icon.pb
-- RestorePoint\RestorePoints.pbi, CreateShowDelete.pb
-- ToastNotification\ToastNotification_1.pb, ToastNotification_2.pb, ToastNotification_3.pb

- PrinterStuff\
-- PrinterStuff.pbi, AddMonitor.pb, DeleteMonitor.pb, AddPort.pb, DeletePort.pb, GetDriver.pb, AddDriver.pb, DeleteDriver.pb,
-- UploadDriverPackage.pb, InstallDriverPackage.pb, DeleteDriverPackage.pb, AddPrinter.pb, DeletePrinter.pb, SetSecurity.pb,
-- EnumerateMonitors.pb, EnumeratePorts.pb, EnumeratePrinters.pb, EnumerateDrivers.pb
-- MS_PS_CD_V3\... (required by AddDriver.pb)
-- MS_PS_CD_V4\... (required by UploadDriver.pb)

- ProcessStuff\AdjustCurrentProcessPrivilege.pb, GetCurrentProcessPrivileges.pb, GetProcessCL.pb, GetProcessList.pb, GetProcessMemoryInfo.pb,
- GetProcessPath.pb, SuspendProcess.pb
-- CallingProcess\process.dll, process.exe, process_DLL.pb, process_EXE.pb
-- ParentProcess\ParentProcess.exe, GetParentProcess.exe, ParentProcess_EXE.pb, GetParentProcess_EXE.pb
-- RunProcess\RPAS.pb (Run Process As SYSTEM), RunProgramEx.pb
-- RunProcess\binaries\RPAU-EXE.pb (Run Process As User)

- ProtocolStuff\FTP.pb, HTTP.pb, Telnet.pb
- ResizeImageFast\ResizeImageFast.pb
- RotateImage\RotateImage.pb
- ScreenCapture\CaptureDesktopAll.pb, ScreenCapturePlus.pb
- SendToNotepad\SendToNotepad.pb
- SQLiteDatabase\ATTACH.pb, RTF2BLOB.pb, SELECT.pb, UPDATE.pb
- WebGadgetExplorer\WG_Explorer.pb
- WebSnapshot\WebSnapshot.pb
- WolframAlpha\WolframAlpha_1.pb, WolframAlpha_2.pb
- XMLStuff\GetXMLNodes.pb
Last edited by JHPJHP on Sat Oct 16, 2021 8:53 pm, edited 434 times in total.

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
Mythros
Enthusiast
Enthusiast
Posts: 306
Joined: Mon Aug 19, 2013 3:28 pm

Re: Services, Stuff, and Shellhook

Post by Mythros »

Sweet, is there a way this can be used for example to check whether 2 same processes are open at once?
User avatar
JHPJHP
Addict
Addict
Posts: 1853
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Services, Stuff, and Shellhook

Post by JHPJHP »

Hi Mythros,

Stuff Folder:
- GetProcessPath.pb can be used to check for a running PATH\executable
- ProcessList.pb can be used to check for a running executable

Shellhook Folder
- shellhook.pb includes the following FindWindow Procedure

Code: Select all

Procedure FindWindow(WindowName.s)
  Protected hWnd

  hWnd = GetWindow_(GetDesktopWindow_(), #GW_CHILD)

  Repeat
    winCaption.s = Space(#MAX_PATH)
    GetWindowText_(hWnd, winCaption, #MAX_PATH)

    If Len(Trim(winCaption)) > 0
      If FindString(winCaption, WindowName) > 0 : Break : EndIf
    EndIf
    hWnd = GetWindow_(hWnd, #GW_HWNDNEXT)
  Until hWnd = 0
  ProcedureReturn hWnd
EndProcedure

hWnd = FindWindow("Window Watcher")

If hWnd
  MessageBox_(hWnd, "The application is already running.", "Window Watcher", #MB_ICONWARNING)
EndIf
Another option may be to use either the CreateMutex or FindWindow function.
- CreateMutex: http://msdn.microsoft.com/en-us/library ... s.85).aspx
-- test for: GetLastError = ERROR_ALREADY_EXISTS
- FindWindow: http://msdn.microsoft.com/en-us/library ... s.85).aspx
-- test for: return value NOT NULL
Last edited by JHPJHP on Thu Nov 20, 2014 2:10 am, edited 1 time in total.

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
User avatar
JHPJHP
Addict
Addict
Posts: 1853
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Services, Stuff, and Shellhook

Post by JHPJHP »

Updated the Services scripts to be more intuitive and easier to use.

See the first post for a more in-depth description.

Cheers!

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
User avatar
Rings
Moderator
Moderator
Posts: 1403
Joined: Sat Apr 26, 2003 1:11 am

Re: Services, Stuff, and Shellhook

Post by Rings »

thx a lot
SPAMINATOR NR.1
User avatar
JHPJHP
Addict
Addict
Posts: 1853
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Services, Stuff, and Shellhook

Post by JHPJHP »

Hi Rings,

You're welcome, and thank you for your many positive comments across my "Tricks 'n' Tips" posts.

--------------------------------------

The following are some simple examples that may help a beginner with learning PureBasic:
- updated the Stuff folder

Added 3 additional script files and 1 image file.
- GlobalKeyboardHook.pb: global keyboard hook capturing keystrokes
-- currently set to capture: A - Z, ESC to quit
- RotateImage.pb: 90, 180, 270, and flip
-- logo.jpg: image used by: RotateImage.pb
- TreeGadget_Sync.pb: 2 TreeGadget's synced

--------------------------------------

Here is another example added to the Stuff folder.
- ADS.pb: (Windows) Alternate Data Streams
-- http://www.bleepingcomputer.com/tutoria ... a-streams/

The example demonstrates one approach to hide / link an executable to a text file, but the process is not limited to text / executable files.
- read the documentation to better understand the application and dangers with using this method
Last edited by JHPJHP on Mon Dec 29, 2014 6:46 pm, edited 1 time in total.

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
User avatar
JHPJHP
Addict
Addict
Posts: 1853
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Services, Stuff, and Shellhook

Post by JHPJHP »

Added another three examples to the folder: Stuff
- CacheChrome.pb
- CacheExplorer.pb
- AlwaysOnTop.pb

Both cache examples list browser cache with the option to delete.
- unlike other browsers Google Chrome uses SQLite to store cache

AlwaysOnTop.pb: Tries to set the window using the current thread as the active window.

----------------------------------------------------

Updated all the examples to work with Windows 8.
- an additional update was made to the service example
-- #SC_MANAGER_ALL_ACCESS was changed to #SC_MANAGER_ENUMERATE_SERVICE

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
User avatar
JHPJHP
Addict
Addict
Posts: 1853
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Services, Stuff, and Shellhook

Post by JHPJHP »

Added another three examples to the folder: Stuff
- RunElevated.pb: run an executable in an elevated process using the Function: ShellExecuteEx
- SetManifest.pb: set a manifest file to an executable
- IsOS64Bit.pb: returns true if the OS is 64 bit otherwise false

I used the RunElevated & SetManifest scripts in the latest update to PureBasic Interface to WinDivert.

Information:
- http://mfctips.com/2013/01/04/createpro ... -manifest/
- http://msdn.microsoft.com/en-us/library ... 85%29.aspx
-- tool to view manifest in binary: http://www.angusj.com/resourcehacker/

Running the example: SetManifest.pb on the current folder will set: rpau.manifest to the executable: rpau.exe.

I used the IsOS64Bit script in updating the example: GetProcessCL.pb.
- http://stackoverflow.com/questions/1581 ... -or-64-bit

NB*: Numerous other improvements have been made to various examples.

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
User avatar
JHPJHP
Addict
Addict
Posts: 1853
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Services, Stuff, and Shellhook

Post by JHPJHP »

Added another example to the Stuff folder:
- ListIconGadget_Move.pb: allows the moving of multiple selected items [ CTRL / SHIFT ]

NB*: Update also includes numerous improvements and bug fixes to various examples.
Last edited by JHPJHP on Wed Feb 18, 2015 5:45 am, edited 3 times in total.

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
User avatar
JHPJHP
Addict
Addict
Posts: 1853
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Services, Stuff, and Shellhook

Post by JHPJHP »

Updated:
- GetExternalIP.pb: get the external IP Address using DNS
- WebGadget_NoScroll.pb: remove scrolling / scrollbars from the webgadget
Last edited by JHPJHP on Wed Feb 18, 2015 6:02 am, edited 2 times in total.

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
User avatar
JHPJHP
Addict
Addict
Posts: 1853
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Services, Stuff, and Shellhook

Post by JHPJHP »

Added another couple examples to the Stuff folder:
- MovieData
-- Alternate Data Stream (folder: ADS)
--- folder: videos
---- walking.avi
--- MovieData.pb
---- MovieData.exe
--- ADS.pb
-- DataSection (folder: DS)
--- MovieData.pb
---- MovieData.exe
--- DataSection.pbi

The example: MovieData.pb was from a question asked here: http://www.purebasic.fr/english/viewtop ... 78#p459078

The ADS folder example uses an Alternate Data Stream to conceal the video file.
- the current executable: MovieData.exe will not work because zip files do not include ADS
-- if I chose to compress using WinRAR the option to include ADS is available
- recompile the file: MovieData.pb (MovieData.exe) then add the ADS by running the file: ADS.pb

The DS folder example uses a DataSection to conceal the video file.
- the example highlights PureDataConverter by ts-soft

NB*: In both examples the temp file is created in the current directory, but this should be changed for better concealment.
- Function: GetTemporaryDirectory

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
User avatar
JHPJHP
Addict
Addict
Posts: 1853
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Services, Stuff, and Shellhook

Post by JHPJHP »

Added another three examples to the Stuff folder.
- folder: MoreStuff
-- AWS.pb: (Amazon Web Services) used to retrieve a variety of information
--- utilizes the script (HMAC_SHA1 Procedure) by hss: http://www.purebasic.fr/english/viewtop ... 12&t=46460
-- CreateMountableImage.pb: creates a mountable image file from a folder location
--- bingo did it first: http://www.purebasic.fr/english/viewtopic.php?t=29757
-- Power2Bitwise.pb: extracted from: PureBasic Interface to ImDisk

AWS.pb
- the following information will need to be filled in for the example to work

Code: Select all

SecretAccessKey.s = ""
AWSAccessKeyId.s = ""
AssociateTag.s = ""
CreateMountableImage.pb
- a mountable image file cannot be created from a drive-root, or a circular reference

Power2Bitwise.pb

I asked myself this question: If given a number that is the total sum of a group of numbers, how can I extract the individual numbers?

General information:
- counting by powers of two: 1, 2, 4, 8, 16, 32, 64, 128, 256, ...
-- every leading number is greater (by 1) then the sum of all the previous numbers combined

Power of Two / Bitwise:
- Value = Pow(2, nCount) (starting from 0)
-- nCount: the position in the series you want returned: Pow(2, 6) = 64
- (Value & Sum) = Value (Bitwise comparison)
-- Value: the number you want to test is included in the Sum
-- Sum: the sum of various numbers from the series

NB*: I've use the "Power of Two / Bitwise" technique in conjunction with a database to control access privileges, track various auditing information, etc.
Last edited by JHPJHP on Thu Nov 30, 2017 5:35 pm, edited 2 times in total.

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
User avatar
JHPJHP
Addict
Addict
Posts: 1853
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Services, Stuff, and Shellhook

Post by JHPJHP »

Added another two examples to the Stuff folder:
- WindowStuff/TimerStuff
-- messagebox.pb
-- splash.pb
--- processing.gif

splash.pb: from a question asked here: http://www.purebasic.fr/english/viewtop ... =7&t=61565
- a timed splash window created in a separate thread

messagebox.pb: something I was going to use in: PureBasic Interface to UnRAR (WinRAR)
- a timed message box created in a separate thread
Last edited by JHPJHP on Wed Feb 18, 2015 5:43 am, edited 2 times in total.

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
User avatar
JHPJHP
Addict
Addict
Posts: 1853
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Services, Stuff, and Shellhook

Post by JHPJHP »

Added another four examples to the Stuff folder:
- SendToNotepad
-- SendToNotepad.pb
--- gpl.txt (test file)
- WindowStuff/CopyData
-- Text_Send.pb, Text_Receive.pb
- WindowStuff/ShareMemory
-- Image_Send.pb, Image_Receive.pb, baboon.jpg
-- Text_Send.pb, Text_Receive.pb

SendToNotepad
- Open / change the Title of Notepad / Work with an opened instance of Notepad
-- RunNotepad: two optional parameters (Title.s, nDelay)
- Append (newline)
-- WriteToNotepad: nStart < 0 (default) / nLength < 0 (default)
- Prepend (newline)
-- WriteToNotepad: nStart = 0 / nLength < 0 (default)
- Replace
-- WriteToNotepad: nStart >= 0 / nLength > 0
- ReplaceAll
-- WriteToNotepad: nStart = 0 / nLength = 0
- Insert
-- WriteToNotepad: nStart > 0 / nLength <= 0 (default)

ShareMemory
- CopyData examples pass text from one PureBasic window to another.
- ShareMemory examples pass text / images from one PureBasic window to another

--------------------------------------------------------------------

Updated the Share Memory examples.
- Image_Send.pb: includes the option to change images
- Image_Receive.pb: includes a separate thread to monitor changes
Last edited by JHPJHP on Wed Feb 18, 2015 1:29 am, edited 4 times in total.

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
marroh
User
User
Posts: 72
Joined: Wed Aug 06, 2008 8:21 am

Re: Services, Stuff, and Shellhook

Post by marroh »

Thx for update and share :mrgreen:
PureBASIC v5.41 LTS , Windows v8.1 x64
Forget UNICODE - Keep it BASIC !
Post Reply