open-insight/LSL2/STPROC/SRP_IO.txt
Infineon\StieberD 7762b129af pre cutover push
2024-09-04 20:33:41 -07:00

74 lines
3.1 KiB
Plaintext

Function SRP_IO(@Service, @Params)
/************************************************************************************************
This program is proprietary and is not to be used by or disclosed to others, nor is it to
be copied without written permission from SRP Computer Solutions, Inc.
Name : SRP_IO
Description : Service module input / output operations.
Notes : For more information visit https://docs.microsoft.com/en-us/windows/win32/api/fileapi/
For a list of Windows error messages visit:
https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-
Parameters:
Service [IN] - The service to execute
Params [IN] - Service specific parameters
History (Date, Initials, Notes)
09/04/20 djs Original programmer
************************************************************************************************/
#pragma precomp SRP_PreCompiler
$insert SERVICE_SETUP
$insert LOGICAL
$insert SRP_IO_EQUATES
Declare function SRPWinAPI_CreateFile, SRPWinAPI_GetLastError
Declare subroutine SRPWinAPI_CloseHandle, Error_Services
GoToService else
Error_Services('Set', Service : ' is not a valid service request within the ' : ServiceModule : ' services module.')
end
Return Response or ""
//-----------------------------------------------------------------------------
// Service Parameter Options
//-----------------------------------------------------------------------------
Options DESIRED_ACCESS = GENERIC_READ$, GENERIC_WRITE$, GENERIC_EXECUTE$, GENERIC_ALL$
Options SHARE_MODE = FILE_SHARE_NONE$, FILE_SHARE_DELETE$, FILE_SHARE_READ$, FILE_SHARE_WRITE$
Options CREATION_DISPOSITION = CREATE_ALWAYS$, CREATE_NEW$, OPEN_ALWAYS$, OPEN_EXISTING$, TRUNCATE_EXISTING$
Options FILE_ATTRIBUTES = FILE_ATTRIBUTE_ARCHIVE$, FILE_ATTRIBUTE_ENCRYPTED$, FILE_ATTRIBUTE_HIDDEN$, FILE_ATTRIBUTE_NORMAL$, FILE_ATTRIBUTE_OFFLINE$, FILE_ATTRIBUTE_READONLY$ FILE_ATTRIBUTE_SYSTEM$, FILE_ATTRIBUTE_TEMPORARY$
//-----------------------------------------------------------------------------
// SERVICES
//-----------------------------------------------------------------------------
Service LockFile(FilePath, DesiredAccess = DESIRED_ACCESS, ShareMode = SHARE_MODE, CreationDisposition = CREATION_DISPOSITION, FileAttributes = FILE_ATTRIBUTES)
If FileAttributes EQ '' then FileAttribute = FILE_ATTRIBUTE_NORMAL$
SecurityAttributes = 0 ; // Pointer to security structure - not utilized by this service module at this time
TemplateFile = 0 ; // Handle to a template file - not utilized by this service module at this time
FileHandle = SRPWinAPI_CreateFile(FilePath, DesiredAccess, ShareMode, SecurityAttributes, CreationDisposition, FileAttributes, TemplateFile)
Response = FileHandle
End Service
Service UnlockFile(FileHandle)
SRPWinAPI_CloseHandle(FileHandle)
End Service
Service GetLastError()
Response = SRPWinAPI_GetLastError()
end service