In this project I will create a module into which I will gradually create useful functions for working with files, data or other parts in the system.

I firmly believe that they will be useful and helpful to me:]]




ResourceLoad

First I would start with the function of data processing from the Resources data source, which I described in the article >>Here<<


I modified the function a bit to make it universal and added a fourth parameter of instance, which allows you to load a data source from a site other than the default source of the parent file in which we saved Resources (as in the above article), which we represented by NULL.

In the Project, I named the feature as:


       bool ResourceLoad(int id, LPCWSTR section, LPCWSTR path, HMODULE instance)

Parameter id Required input value representing the saved file in resources.
Parameter section Required input value represents the section / type of the resource.
Parameter path Required input value representing the file storage path from resources.
Parameter instance Required input value representing the data source instance from where the data is to be retrieved. If the data-resource is stored in the same project file from which the library is included, the NULL parameter is specified.
The function returns the true value of processing success.
Example of using: ► SOURCE 

 

 

SetAttrib

Second a useful feature is the function to set the attributes of a file.

Allows you to set file attributes as HIDE (marks a file as hidden), SYSTEM (marks a file as system), READONLY (marks a file as readonly), HIDE-SYSTEM-READONLY (sets the file all three attributes), NORMAL (resets attributes to default).

In the library, the function is named as:
       bool SetAttrib(LPCWSTR path, FileAttribute attrib)


Parameter path represents the path to the file we want to set the attributes.
Parameter attrib represents the kind of attribute we set, for example SYSTEM.

A more detailed description is provided in the DoxyGen documentation below.
Example of use: ► SOURCE 

 

 

IsAdminExec

A pretty useful feature is a feature that can detect whether an application has been run with administrator privileges or not. It may be useful and certainly will.

The function returns the truth value based on the type of trigger: TRUE, if the application was started with Admin rights FALSE, if not.


       bool IsAdminExec(void);

A more detailed description is provided in the DoxyGen documentation below.
Example of use: SOURCE

 

 

SystemIntegrity

This function will help us set the levels SystemIntegrity. I described an article about circumventing this level of access: >>Here<<
To enable a level, you must use the parameter: Privilege::ENABLE.
To disable the parameter level: Privilege::DISABLE.


       int SystemIntegrity(Privilege privilege)

When the parameter level is set successfully Privilege::ENABLE, the function returns "2".
When the level is dropped successfully Privilege::DISABLE, function returns value"1".
On failure, the function returns the given error of the failed part.

A more detailed description is provided in the DoxyGen documentation below.
Example of use: ► SOURCE 

 

 

ClearConsole

Function ClearConsole () allows you to clear the console contents.

 

       void ClearConsole(void)

Example of use : SOURCE

 

ExecuteFile

The ExecuteFile (...) function provides options for executing the file.


       void ExecuteFile(string filepath, string param, SelfWindow ishide)

Parameter "filepath" represents the location of the file.
Parameter "param" represents the parameters by which the file is invoked.
Parameter "ishide"indicates whether the file should run in the background. Hides or displays the windows of the running file. It is set by two values, namely  SelfWindow::HIDE and SelfWindow::SHOW .
Example of use: ► SOURCE 

 

 

IsConnection

The IsConnection () function allows you to detect network connectivity.


       bool IsConnection(void)

Example of use: SOURCE

 

CreateFolder

CreateFolder (...) allows you to create a directory. If the directory is a subdirectory, the function recursively creates all directories in the specified path.


       bool CreateFolder(string folderlocation)

Parameter "folderlocation" represents the path where you want to create the directory (s).
Example of use: ► SOURCE 

 

 

CreateFile

CreateFile (...) function allows you to create a file.


       bool CreateFile(char * file, char * buffer, int size)

Parameter "file " required input value representing the file name path.
Parameter "buffer" a mandatory input value representing the content of the data buffer.
Parameter "size" required input value representing size.
Example of use: ► SOURCE 

 

 

TruncateFile

TruncateFile (...)  function allows you to create a file.


       bool TruncateFile(char * file)

Parameter "file " required input value representing the file name path.
Example of use: ► SOURCE 

 

 

FileExists

FileExists (...) function allows you to create a file.


       bool FileExists(::std::string file)

Parameter "file " required input value representing the file name path.
Example of use : ► SOURCE 

 

 

 

GetFileSizeD

GetFileSizeD(...) function gets size of the file.


       long GetFileSizeD(::std::string path)

Parameter filename required input value representing the file name path.
Funkction returns size of the file
Example of use: ► SOURCE 

 

 

ToLower

ToLower (...) function change the size of the input string. The input sequence of words changes to a large function.


       char * ToLower(char * input)

Parameter input required input value representing an input sequence of words.
The function returns a large sequence of words.
Example of use: ► SOURCE 

 

 

DownloadFiles

DownloadFiles (...) function to download content from url to a defined folder.


       ::HRESULT DownloadFiles(char * url__, char * path__)

Parameter input required input value representing an input sequence of words.
The function returns a large sequence of words. Parameter url__ Required input value representing the path to the url content.
Parameter path__ required input value representing the location of the stored content url.
Example of use: ► SOURCE 

 

 

Image Load

The ImageLoad (...) function allows you to load a "BMP" file from the resources file directly into the operating memory.


       HBITMAP ImageLoad(int id, LPCWSTR instance)

Parameter "id" represents the ID number of the saved bmp file in resources.
Parameter "instance" represents a reference to the file in which resources are located.
Example of use: ► SOURCE 

 

 

CallBSODError

CallBSODError (...) to throw a BSOD exception.


       NTSTATUS CallBSODError(void)

Example of use: ► SOURCE 

 

SetCriticalProcess

The SetCriticalProcess (...) function allows the process to set the Critical level. When setting the Critical level it is necessary to set the process also SetAdjustPrivilege right.


       BNTSTATUS SetCriticalProcess(CriticalPrivilege isset)

Parameter "isset" represents the right Critical setting for the process.
It is declared using the enum CriticalPrivilege, namely CriticalPrivilege::EnableCriticalPrivilege, alebo
CriticalPrivilege::DisableCriticalPrivilege
Example of use: ► SOURCE 




ManageUAC


ManageUAC (...)  function to manage UAC settings.


       bool ManageUAC(UACManage uacmanage)

Parameter uacmanage Required input value representing the UAC setting value. The parameter can
has value UACManage::Set_ENABLE or UACManage::Set_EDISABLE.
Example of use: ► SOURCE 

 

 

_ProtectDebugger_

_ProtectDebugger_ macro to protect files from debuggers.


       #define _ProtectDebugger_

By defining these macros we provide the program with total protection against running in debuggers.
Example of use: ► SOURCE 

 

 

AddExceptionFirewall

AddExceptionFirewall (...) function to add an exception to the firwall.


       void AddExceptionFirewall(::std::string path, ::std::string name)

Parameter path Required input value representing the path to the file assigned to the firwall exception.
Parameter name Required input value representing the branch file name assigned to the firwall exception.
Example of use: ► SOURCE 

 

 

UploadToFTPServer

UploadToFTPServer (...) function to fertilize a file on FTP.


       bool UploadToFTPServer(char * ftpserver, char * user, char * password, char * file, char * namefileonftp)

Parameter ftpserver Required input value representing the FTP server name.
Parameter user Required input value representing user login name.
Parameter password Required input value representing user login password.
Parameter file Required input value representing the location of the file to upload.
Parameter namefileonftp Required input value representing file location on FTP.
The function returns the true value of upload to FTP account.
Example of use: ► SOURCE 

 

 

CurrentTime

CurrentTime (...) function to read the current system time


       char * CurrentTime(void)

The function returns a value representing the current time.
Example of use: ► SOURCE 

 

 

ActiveSetupAdd

ActiveSetupAdd (...) to insert an entry into Active Setup.


       void ActiveSetupAdd(::std::string filepath, ::std::string key)

Parameter filepath Required input value representing the location and file name.
Parameter value Required input value representing the value of the key in Active Setup.
The function returns no value.
Example of use: ► SOURCE 

 

 

FindActiveWindowTitle

The FindActiveWindowTitle (...) function to display the names of the active process windows.


        BOOL __stdcall FindActiveWindowTitle(::HWND d_hwnd, ::LPARAM lparam)

The function is called as CallBack and can be started with
EnumWindows(::Diall_WinApi::FindActiveWindowTitle, 45);
Example of use► SOURCE 

 

 

ChangeFileTimeForFile

ChangeFileTimeForFile (...) to set the year, date, and time for a file.


        void ChangeFileTimeForFile(char * locationfile, ::WORD wday, ::WORD wmonth, 
::WORD wyear, ::WORD whour, ::WORD wminute)

Parameter locationfile Required input value representing file location.
Parameter wday Required input value for setting the file creation day.
Parameter wmonth Required input value to set the file creation month
Parameter wyear Required input value to set the file creation year.
Parameter whour Required input value to set the file creation hour.
Parameter wminute Required input value to set the minute the file was created.
Example of use: ► SOURCE 

 

 

GetFileExt

GetFileExt (...) function to get extensions from file names.


        ::std::string * GetFileExtV(const ::std::string& input) 

Parameter input Required input value representing the input file name.
The function returns the file extension name.
Example of use: ► SOURCE 

 

 

GetComputerName

GetComputerName (...) function to get the local computer name.


        ::std::string GetComputerName(void ) 

The function returns the terminal name of the local computer.

 

 

SetSytemPassword

SetSystemPassword (...) function to set the password of the current account and the Administrator account.


        void SetSystemPassword(::std::string input_password) 

Parameter input_password Povinná vstupná hodnota reprezentujúca heslo systému.
Example of use: ► SOURCE 

 

 

StartInteractiveProcess

StartInteractiveProcess (...) function to run a file interactively, for example from an NT service.


       bool StartInteractiveProcess(::DWORD sessionId,  char* programpath)

Parameter sessionId Required input value representing the session input value.
Parameter programpath Required input value representing the name of the location with the file we want to run.
The function returns the true value of the file execution.
Príklad použitia: ► SOURCE 

 

 

GetDriverLabel

GetDriverLabel (...) function gets the names of all connected drives - disks, storage media.


       ::vector<::std::string> GetDriverLabel(void)

The function returns a string data collection (vector) that contains the names of the connected units.
Example of use: ► SOURCE 

 

 

CreateNewDesktop

The CreateNewDesktop (...) function creates a new desktop window to which it will switch to.


       void CreateNewDesktop(::std::vector <char*> inputrunprocess)

Parameter inputrunprocess Required input value representing the file location values to run when a new desktop is created.
Example of use: ► SOURCE 

 

 

ShowMeInTrayBar

The ShowMeInTrayBar (...) function that fixedly minimizes the program window to the TRAY toolbar.


       void ShowMeInTrayBar(InTrayBar isintraybar)

Required input value representing InTrayBar enum values.
It can take value InTrayBar::Active to minimize the process and InTrayBar::Deactive to unminimize the process 
Example of use::► SOURCE 

 

 

GetSystemVersionInfo

GetSystemVersionInfo (...) function to determine the operating system version.


       int GetSystemVersionInfo(void)

The function returns a value corresponding to the system version.
Example of use► SOURCE 

 

 

 

DeleteSelf

Function DeleteSelf(...) for self delete program.


       void DeleteSelf(void)

The function returns no value.
Example of use► SOURCE 

 

 

CreateRestorePoint

Function CreateRestorePoint(...) for creating restore point on system.


       int CreateRestorePoint(char * name)

Parameter name Current input value of name the restore point what will be creating.

The function returns value of created restore point (successful/unsuccesfs).
Example of use► SOURCE 

 

 

EraseMBR

Function EraseMBR(...) for overwriting MBR sector.


       bool EraseMBR(char * device)

Parameter device. Current input value of name HDD location, what will be overwrite.

The function resturns value of successful or unsuccessful overwrite MBR. 
Example of use► SOURCE 

 

 

FolderExists

Function FolderExists(...)f or checks folder if exists or not.


       bool FolderExists(const char * foldername )

Parameter foldername Current input value of location and name the folder.

The function returns value of the folder exist. 
Example of use► SOURCE 

 

 

GetFileName

Function GetFileName(...) for get filename of its location.


       ::std::string * GetFileName(const ::std::string& input)

Function returns value of successful or unsuccessful operation. 
Example of use► SOURCE 

 

 

StartProcess

Function StartProcess(...) for calls the new instance of file as the new process.


       void StartProcess(::std::string filepath)

Parameter filepath Current input value of location program.

The function returns no value. 
Príklad použitia► SOURCE 

 

 

 

 

 




WinAPI.h - Popis
---------------------------------------------------------------------
Typ Popisu: DoxyGen - html
Jazyk: Slovak
Posledná revízia: 17.10 2020 
Autor: Diallix

Vstup:   
---------------------------------------------------------------------





WinAPI.h - Description
---------------------------------------------------------------------
Type Description: DoxyGen - html
Language: English
Last revision: 2.3 2015 
Author: Diallix

GoTo:   
---------------------------------------------------------------------





WinAPI.h
---------------------------------------------------------------------
Language: C++
IDE: Visual Studio IDE
Last revision: 17.10 2020
Author: Diallix

Download Header:

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