This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// OpenService function is part of the Windows API, and it is used to open a handle to an existing service in the Service Control Manager (SCM) database. The SCM is responsible for managing services on a Windows system. | |
#include <iostream> | |
#include <windows.h> | |
using namespace std; | |
int main() | |
{ | |
const wchar_t *serviceName = L"AdobeARMservice"; | |
SC_HANDLE scmHandle = OpenSCManager(NULL,NULL,SC_MANAGER_CONNECT); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To get the service name of a running service in Windows, you can use the EnumServicesStatus function to enumerate through the services in the Service Control Manager (SCM) database and retrieve information about each service, including its name. | |
#include <iostream> | |
#include <windows.h> | |
using namespace std; | |
int main() | |
{ | |
SC_HANDLE scmHandle = OpenSCManager(NULL,NULL,SC_MANAGER_CONNECT|SC_MANAGER_ENUMERATE_SERVICE); | |
if(scmHandle == NULL) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// OpenSCManager function is part of the Windows API, and it is used to open a handle to the Service Control Manager (SCM) database on a local or remote computer. The SCM is responsible for managing services on a Windows system. | |
#include <iostream> | |
#include <windows.h> | |
using namespace std; | |
int main() | |
{ | |
// OpenSCM | |
SC_HANDLE scmHandle = OpenSCManager(NULL,NULL,SC_MANAGER_CONNECT); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// GetLocalTime function is part of the Windows API and is used to retrieve the current local system time. | |
#include <iostream> | |
#include <windows.h> | |
using namespace std; | |
int main() | |
{ | |
SYSTEMTIME localTime; | |
GetLocalTime(&localTime); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SetFileAttributes function is part of the Windows API and is used to set the attributes of a file or directory. Attributes include information such as whether the file is read-only, hidden, or system, among others. | |
#include <iostream> | |
#include <windows.h> | |
using namespace std; | |
int main() | |
{ | |
const wchar_t *filePath = L"E:\\newFile.txt"; | |
DWORD fileAttributes = FILE_ATTRIBUTE_READONLY; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// GetWindowsDirectory function is a part of the Windows API and is used to retrieve the path of the Windows directory. The Windows directory is where the core operating system files are stored. | |
#include <iostream> | |
#include <windows.h> | |
using namespace std; | |
int main() | |
{ | |
TCHAR windowsDirectory[MAX_PATH]; | |
int result = GetWindowsDirectory(windowsDirectory,MAX_PATH); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// AllocateAndInitializeSid function is part of the Windows API, specifically the Security Support Provider Interface (SSPI), and it is used for managing security identifiers (SIDs). SIDs are unique identifiers assigned to each security principal, such as a user or a group, in Windows. | |
#include <iostream> | |
#include <windows.h> | |
using namespace std; | |
int main() | |
{ | |
PSID psid = NULL; | |
SID_IDENTIFIER_AUTHORITY sidAuth = SECURITY_NT_AUTHORITY; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <windows.h> | |
using namespace std; | |
int main() | |
{ | |
int screenWidth = GetSystemMetrics(SM_CXSCREEN); | |
int screenHeight = GetSystemMetrics(SM_CYSCREEN); | |
int screenMonitors = GetSystemMetrics(SM_CMONITORS); | |
cout<<"Screen width = "<<screenWidth<<" px"<<endl; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <windows.h> | |
using namespace std; | |
int main() | |
{ | |
TCHAR systemDirectory[MAX_PATH]; | |
DWORD result = GetSystemDirectory(systemDirectory,MAX_PATH); | |
if(result !=0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <windows.h> | |
using namespace std; | |
int main() | |
{ | |
CString filePath = L"E:\\samplefile.txt"; | |
SHFILEINFO shfi; | |
ZeroMemory(&shfi,sizeof(shfi)); |
NewerOlder