#include <stdio.h>
#include "../../basext.h"
#include <windows.h>
#include <winbase.h>
#include <winreg.h>
#include <tlhelp32.h>
#include <winsvc.h>
#include <winnt.h>
#include <winioctl.h>
#include <string.h>
#include <tchar.h>
Go to the source code of this file.
Data Structures | |
struct | _REPARSE_DATA_BUFFER |
Defines | |
#define | NT_ERROR_INVALID_KEY 0x00081001 |
#define | NT_ERROR_NOT_DELETED 0x00081002 |
#define | NT_ERROR_REGISTRY 0x00081003 |
#define | NT_ERROR_NOT_SET 0x00081004 |
#define | STRING_BUFFER_LENGTH 256 |
#define | IFK(Y) |
#define | IFK(Y, X) |
#define | CONTROL_NT_SERVICE(X) ControlNtService(pSt,ppModuleInternal,pParameters,X) |
#define | REPARSE_MOUNTPOINT_HEADER_SIZE 8 |
#define | FSCTL_SET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 41, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) |
#define | FSCTL_GET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS) |
#define | FSCTL_DELETE_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 43, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) |
#define | toUnicode(FROM, TO) |
Typedefs | |
typedef _REPARSE_DATA_BUFFER | REPARSE_DATA_BUFFER |
Functions | |
besVERSION_NEGOTIATE | return (int) |
besFUNCTION (regread) | |
if (sLen) | |
if (Ret!=ERROR_SUCCESS) | |
if (Ret==ERROR_MORE_DATA) | |
RegCloseKey (hRes) | |
besFREE (s) | |
switch (dwType) | |
besFREE (pszData) | |
besEND | besFUNCTION (regdel) |
while (sLen &&*r!= '\\') | |
besEND | besFUNCTION (regwrite) |
besDEREFERENCE (Argument) | |
switch (TYPE(Argument)) | |
besFREE (pszTitle) | |
besFREE (pszCaption) | |
besFREE (pszButtons) | |
besFREE (pszStyle) | |
besALLOC_RETURN_STRING (1) | |
switch (iMsgResult) | |
besEND | besFUNCTION (shutdown_nt) |
if (Lval &&*Lval) | |
if (lProcCount==0) | |
while (Process32Next(th,&pe)) | |
CloseHandle (th) | |
besEND | besFUNCTION (nt_startservice) |
memset (&SSTAT, 0, sizeof(SSTAT)) | |
if (!QueryServiceStatus(hService,&SSTAT)) | |
if (SSTAT.dwCurrentState==SERVICE_START_PENDING||SSTAT.dwCurrentState==SERVICE_RUNNING||SSTAT.dwCurrentState==SERVICE_CONTINUE_PENDING) return COMMAND_ERROR_SUCCESS | |
CloseServiceHandle (hService) | |
CloseServiceHandle (hManager) | |
if (if iError==0) | |
besFUNCTION (nt_stopservice) | |
static int | lnw (char *pszSource, char *pszDestination) |
void | PrintWin32Error (DWORD x) |
static int | CreateJunction (char *LinkDirectory, char *LinkTarget) |
Variables | |
cbData = 0 | |
Ret = RegQueryValueEx(hRes,r,NULL,&dwType,&szDummy,&cbData) | |
sLen = STRLEN(Argument) - sLen | |
r = s + STRLEN(Argument) | |
Ret = RegDeleteValue(hRes,r) | |
return | COMMAND_ERROR_SUCCESS |
Argument = besARGUMENT(2) | |
iMsgResult | |
iError = StartService(hService,0,NULL) |
|
Definition at line 824 of file interface.c. |
|
Definition at line 1065 of file interface.c. |
|
Definition at line 1064 of file interface.c. |
|
Definition at line 1063 of file interface.c. Referenced by CreateJunction(). |
|
Value: if( STRLEN(Argument) >= (*pLen = strlen(#Y)) && ! memcmp(STRINGVALUE(Argument),#Y,*pLen) ){\ *phKey = X;\ }else |
|
Value: if( STRLEN(Argument) >= (*pLen = strlen(#Y)) && ! memcmp(STRINGVALUE(Argument),#Y,*pLen) ){\ *phKey = Y;\ }else Referenced by return(). |
|
|
|
|
|
|
|
Referenced by switch(). |
|
Definition at line 1060 of file interface.c. Referenced by CreateJunction(). |
|
Referenced by cft_GetConfigFileName(). |
|
Value: MultiByteToWideChar(CP_ACP, \ 0, \ (char *)FROM, \ strlen((char *)FROM)+1,\ TO, \ sizeof(TO)) Definition at line 1070 of file interface.c. Referenced by CreateJunction(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
=section StopService =H Stop a Windows NT service This function stops an already running Windows NT service. =verbatim nt::StopService "Service name" =noverbatim The argument for this subroutine call is the name of the service to start. This is the name that was used to create the service and you can read this name when you start the graphical service control manager application. The subroutine returns T<undef> value. If the service can not be stopped the function raises error. Definition at line 844 of file interface.c. |
|
=section StartService =H Start a Windows NT service This function starts an installed Windows NT service. =verbatim nt::StartService "Service name" =noverbatim The argument for this subroutine call is the name of the service to start. This is the name that was used to create the service and you can read this name when you start the graphical service control manager application. The subroutine returns T<undef> value. If the service can not be started the function raises error. Calling this subroutine for an already running service is not an error. Definition at line 755 of file interface.c. |
|
=section ShutDown =H ShutDown a Windows NT server or workstation Calling this function shuts down a Windows NT Server, Workstation or W2K machine. It was tested on a W2K Professional. =verbatim nt::ShutDown "machine","message",timeout,force,reboot =noverbatim The first argument is the name of the machine to reboot. If this is T<undef> then the actual machine running is shutting down. The second argument is the message that the system will display on the screen before starting the actual shutdown. This argument may also be T<undef> in case there is no need for such a message. The argument T<timeout> is the number of seconds that the operating system will wait before starting the actual shutdown. T<force> specifies whether applications with unsaved changes are to be forcibly closed. If this parameter is TRUE, such applications are closed. If this parameter is FALSE, a dialog box is displayed prompting the user to close the applications. T<reboot> specifies whether the computer is to restart immediately after shutting down. If this parameter is TRUE, the computer is to restart. If this parameter is FALSE, the system flushes all caches to disk, clears the screen, and displays a message indicating that it is safe to power down or switches off automatically. The function calls the Windows NT T<InitiateSystemShutdown> function. Some sentences of this ScriptBasic documentation was copied from the original documentation of the Windows NT system API documentation. Definition at line 603 of file interface.c. |
|
=section RegWrite =H Write a registry value =verbatim nt::RegWrite "HKLM\\Software\\ScriptBasic\\config",value =noverbatim This function writes the value of a registry value. The key should already exist. If the key is non-existent or the value is not alterable by the program the function raises error that the programmer should capture using the T<ON ERROR GOTO> statement. Definition at line 327 of file interface.c. |
|
=section RegDel =H Delete a registry value or key =verbatim nt::RegDel "HKLM\\Software\\ScriptBasic\\config" =noverbatim This function deletes a value from the registry or deletes a key from the registry. If the argument specifies a registry key it should not have any subkeys. If the registry value or key cannot be deleted for some reason the function raises error that the programmer should capture using the T<ON ERROR GOTO> statement. Definition at line 258 of file interface.c. References besFREE(), and COMMAND_ERROR_SUCCESS. |
|
=section RegRead =H Read the registry =verbatim nt::RegRead("HKLM\\Software\\ScriptBasic\\config") =noverbatim This function reads a registry entry and returns the value of the entry or undef if the entry does not ex-ists or if it is not readable by the interpreter process/thread. If the argument string specifies a key and the last character of the argument is \ then the default value for the key is retrieved. Note that HKLM can have a subkey named config as well as a value named config. The string T<"HKLM\\Software\\ScriptBasic\\config"> refers to the value while T<"HKLM\\Software\\ScriptBasic\\config\\"> refers to the default value of the subkey. Definition at line 145 of file interface.c. |
|
Referenced by CreateJunction(), tty::exists(), file_time_accessed(), file_time_created(), file_time_modified(), fork(), InstallScriptBasic(), lnw(), thread_CreateThread(), and thread_FinishMutex(). |
|
|
|
|
|
Definition at line 1078 of file interface.c. References CloseHandle(), FSCTL_SET_REPARSE_POINT, memcpy(), memset(), NULL, REPARSE_MOUNTPOINT_HEADER_SIZE, _REPARSE_DATA_BUFFER::ReparseDataLength, _REPARSE_DATA_BUFFER::ReparseTag, _REPARSE_DATA_BUFFER::Reserved, slen, sprintf(), _REPARSE_DATA_BUFFER::SymbolicLinkReparseBuffer, and toUnicode. |
|
Definition at line 784 of file interface.c. |
|
|
|
Definition at line 772 of file interface.c. References iError. |
|
Definition at line 704 of file interface.c. |
|
Definition at line 703 of file interface.c. References besRELEASE(), and Lval. |
|
Definition at line 191 of file interface.c. References besFREE(), cbData, COMMAND_ERROR_MEMORY_LOW, NULL, and s. |
|
Definition at line 184 of file interface.c. References besFREE(), COMMAND_ERROR_SUCCESS, and s. |
|
Definition at line 174 of file interface.c. References r. |
|
Definition at line 965 of file interface.c. References CloseHandle(), NULL, and p. |
|
|
|
Definition at line 1068 of file interface.c. |
|
Referenced by DeleteRegistryKey(), GetRegistryKey(), GetSBRegDW(), and GetSBRegString(). |
|
=H The module NT =abstract Windows NT specific functions =end This module implements some Win32 system calls that are not implemented in the core of ScriptBasic but can be helpful for those who want to write system maintenance scripts using ScriptBasic. The reason that these functions are not implemented inside ScriptBasic is that ScriptBasic itself is portable, and whenever a programmer writes a program in pure ScriptBasic it should execute the same way under UNIX as well as under Windows NT/Win98/W2K. Programs using the module nt however are Win32 specific and will not run unaltered under UNIX. Definition at line 55 of file interface.c. References IFK. |
|
Definition at line 556 of file interface.c. References besRETURNVALUE, and STRINGVALUE(). |
|
Definition at line 369 of file interface.c. References Argument, besCONVERT2LONG(), LONGVALUE(), r, Ret, STRINGVALUE(), and STRLEN(). |
|
Definition at line 213 of file interface.c. References besALLOC_RETURN_LONG, besALLOC_RETURN_STRING(), besFREE(), besRETURNVALUE, cbData, COMMAND_ERROR_SUCCESS, LONGVALUE(), memcpy(), NT_ERROR_REGISTRY, and STRINGVALUE(). |
|
|
|
Definition at line 287 of file interface.c. |
|
Definition at line 367 of file interface.c. |
|
Definition at line 189 of file interface.c. Referenced by cft_GetConfigFileName(), GetSBRegDW(), GetSBRegString(), if(), and switch(). |
|
Definition at line 311 of file interface.c. |
|
Definition at line 781 of file interface.c. |
|
Initial value: MessageBoxEx(NULL,pszTitle,pszCaption,uType, MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US)) Definition at line 547 of file interface.c. |
|
Definition at line 286 of file interface.c. |
|
Definition at line 305 of file interface.c. |
|
Definition at line 190 of file interface.c. Referenced by cft_GetConfigFileName(), and switch(). |
|
Definition at line 285 of file interface.c. |