Analitcs

Pesquisar no conteúdo do blog.atlabs.com.br

terça-feira, 1 de julho de 2014

DELPHI - DSiWin32 - Unit com várias Funções legais

Reações: 

Retirado de:
http://gp.17slon.com/gp/dsiwin32.htm

Download da unit:
http://www.atlabs.com.br/download/pascal/DSiWin32.pas

Algumas Funções (até a data de postagem do blog)

  procedure DSiCloseHandleAndInvalidate(var handle: THandle);

  procedure DSiCloseHandleAndNull(var handle: THandle);

  function  DSiMsgWaitForThreeObjectsEx(obj0, obj1, obj2: THandle;

    timeout: DWORD; wakeMask: DWORD; flags: DWORD): DWORD;

  function  DSiMsgWaitForTwoObjectsEx(obj0, obj1: THandle; timeout: DWORD;

    wakeMask: DWORD; flags: DWORD): DWORD;

  function  DSiWaitForThreeObjects(obj0, obj1, obj2: THandle; waitAll: boolean;

    timeout: DWORD): DWORD;

  function  DSiWaitForThreeObjectsEx(obj0, obj1, obj2: THandle; waitAll: boolean;

    timeout: DWORD; alertable: boolean): DWORD;

  function  DSiWaitForTwoObjects(obj0, obj1: THandle; waitAll: boolean;

    timeout: DWORD): DWORD;

  function  DSiWaitForTwoObjectsEx(obj0, obj1: THandle; waitAll: boolean;

    timeout: DWORD; alertable: boolean): DWORD;

  function  DSiWin32CheckHandle(handle: THandle): THandle;

  function  DSiWin32CheckNullHandle(handle: THandle): THandle;

{ Registry }

  TDSiRegistry = class(TRegistry)

  public

    function  ReadBinary(const name: string; const defval: RawByteString): RawByteString; overload;

    function  ReadBinary(const name: string; dataStream: TStream): boolean; overload;

    function  ReadBool(const name: string; defval: boolean): boolean;

    function  ReadDate(const name: string; defval: TDateTime): TDateTime;

    function  ReadFont(const name: string; font: TFont): boolean;

    function  ReadInt64(const name: string; defval: int64): int64;

    function  ReadInteger(const name: string; defval: integer): integer;

    function  ReadString(const name, defval: string): string;

    procedure ReadStrings(const name: string; strings: TStrings);

    function  ReadVariant(const name: string; defval: variant): variant;

    procedure WriteBinary(const name: string; data: RawByteString); overload;

    procedure WriteBinary(const name: string; data: TStream); overload;

    procedure WriteFont(const name: string; font: TFont);

    procedure WriteInt64(const name: string; value: int64);

    procedure WriteStrings(const name: string; strings: TStrings);

    procedure WriteVariant(const name: string; value: variant);

  end; { TDSiRegistry }

  function DSiCreateRegistryKey(const registryKey: string;

    root: HKEY = HKEY_CURRENT_USER): boolean;

  function DSiDeleteRegistryValue(const registryKey, name: string; root: HKEY =

    HKEY_CURRENT_USER; access: longword = KEY_SET_VALUE): boolean;

  function DSiKillRegistry(const registryKey: string;

    root: HKEY = HKEY_CURRENT_USER; access: longword = KEY_SET_VALUE): boolean;

  function DSiReadRegistry(const registryKey, name: string;

    defaultValue: Variant; root: HKEY = HKEY_CURRENT_USER;

    access: longword = KEY_QUERY_VALUE): Variant; overload;

  function DSiReadRegistry(const registryKey, name: string;

    defaultValue: int64; root: HKEY = HKEY_CURRENT_USER;

    access: longword = KEY_QUERY_VALUE): int64; overload;

  function DSiRegistryKeyExists(const registryKey: string;

    root: HKEY = HKEY_CURRENT_USER; access: longword = KEY_QUERY_VALUE): boolean;

  function DSiRegistryValueExists(const registryKey, name: string;

    root: HKEY = HKEY_CURRENT_USER; access: longword = KEY_QUERY_VALUE): boolean;

  function DSiWriteRegistry(const registryKey, name: string; value: int64;

    root: HKEY = HKEY_CURRENT_USER; access: longword = KEY_SET_VALUE): boolean; overload;

  function DSiWriteRegistry(const registryKey, name: string; value: Variant;

    root: HKEY = HKEY_CURRENT_USER; access: longword = KEY_SET_VALUE): boolean; overload;

{ Files }

type

  TShFileOpFlag = (fofAllowUndo, fofFilesOnly, fofMultiDestFiles, fofNoConfirmation,

    fofNoConfirmMkDir, fofNoConnectedElements, fofNoErrorUI, fofNoRecursion,

    fofNoRecurseReparse, fofRenameOnCollision, fofSilent, fofSimpleProgress,

    fofWantMappingHandle, fofWantNukeWarning, fofNoUI);

  TShFileOpFlags = set of TShFileOpFlag;

  function  DSiCanWriteToFolder(const folderName: string): boolean;

  function  DSiCompressFile(fileHandle: THandle): boolean;

  function  DSiConnectToNetworkResource(const networkResource: string; const mappedLetter:

    string = ''; const username: string = ''; const password: string = ''): boolean;

  function  DSiCopyFileAnimated(ownerWindowHandle: THandle; sourceFile, destinationFile:

    string; var aborted: boolean; flags: TShFileOpFlags = [fofNoConfirmMkDir]): boolean;

  function  DSiCreateTempFolder: string;

  procedure DSiDeleteFiles(const folder, fileMask: string);

  function  DSiDeleteOnReboot(const fileName: string): boolean;

  procedure DSiDeleteTree(const folder: string; removeSubdirsOnly: boolean);

  function  DSiDeleteWithBatch(const fileName: string; rmDir: boolean = false): boolean;

  function  DSiDirectoryExistsW(const directory: WideString): boolean;

  function  DSiDisableWow64FsRedirection(var oldStatus: pointer): boolean;

  function  DSiDisconnectFromNetworkResource(mappedLetter: char; updateProfile: boolean =

    false): boolean;

  function  DSiEjectMedia(deviceLetter: char): boolean;

  procedure DSiEmptyFolder(const folder: string);

  function  DSiEmptyRecycleBin: boolean;

  function  DSiEnumFiles(const fileMask: string; attr: integer;

    enumCallback: TDSiEnumFilesCallback): integer;

  function  DSiEnumFilesEx(const fileMask: string; attr: integer;

    enumSubfolders: boolean; enumCallback: TDSiEnumFilesExCallback;

    maxEnumDepth: integer = 0): integer;

  procedure DSiEnumFilesToSL(const fileMask: string; attr: integer; fileList: TStrings;

    storeFullPath: boolean = false; enumSubfolders: boolean = false;

    maxEnumDepth: integer = 0);

  function  DSiFileExistsW(const fileName: WideString): boolean;

  function  DSiFileExtensionIs(const fileName, extension: string): boolean; overload;

  function  DSiFileExtensionIs(const fileName: string; extension: array of string):

    boolean; overload;

  function  DSiFileSize(const fileName: string): int64;

  function  DSiFileSizeW(const fileName: WideString): int64;

  function  DSiGetFolderSize(const folder: string; includeSubfolders: boolean): int64;

  function  DSiGetFileTime(const fileName: string; whatTime: TDSiFileTime): TDateTime;

  function  DSiGetFileTimes(const fileName: string; var creationTime, lastAccessTime,

    lastModificationTime: TDateTime): boolean;

  function  DSiGetLongPathName(const fileName: string): string;

  function  DSiGetNetworkResource(mappedLetter: char; var networkResource: string; var

    connectionIsAvailable: boolean): boolean;

  function  DSiGetSubstDrive(mappedLetter: char): string;

  function  DSiGetSubstPath(const path: string): string;

  function  DSiGetTempFileName(const prefix: string; const tempPath: string = ''): string;

  function  DSiGetTempPath: string;

  function  DSiGetUniqueFileName(const extension: string): string;

  function  DSiIsFileCompressed(const fileName: string): boolean;

  function  DSiIsFileCompressedW(const fileName: WideString): boolean;

  function  DSiKillFile(const fileName: string): boolean;

  function  DSiLoadMedia(deviceLetter: char): boolean;

  function  DSiMoveFile(const srcName, destName: string; overwrite: boolean = true): boolean;

  function  DSiMoveOnReboot(const srcName, destName: string): boolean;

  procedure DSiRemoveFolder(const folder: string);

  function  DSiRevertWow64FsRedirection(const oldStatus: pointer): boolean;

  function DSiSetFileTime(const fileName: string; dateTime: TDateTime;

    whatTime: TDSiFileTime): boolean;

  function  DSiSetFileTimes(const fileName: string; creationTime, lastAccessTime,

    lastModificationTime: TDateTime): boolean;

  function  DSiShareFolder(const folder, shareName, comment: string): boolean;

  function  DSiUncompressFile(fileHandle: THandle): boolean;

  function  DSiUnShareFolder(const shareName: string): boolean;

{ Processes }

  function  DSiAddAceToDesktop(desktop: HDESK; sid: PSID): boolean;

  function  DSiAddAceToWindowStation(station: HWINSTA; sid: PSID): boolean;

  function  DSiAffinityMaskToString(affinityMask: DWORD): string;

  function  DSiGetCurrentProcessHandle: THandle;

  function  DSiGetCurrentThreadHandle: THandle;

  function  DSiEnablePrivilege(const privilegeName: string): boolean;

  function  DSiExecute(const commandLine: string;

    visibility: integer = SW_SHOWDEFAULT; const workDir: string = '';

    wait: boolean = false): cardinal;

  function  DSiExecuteAndCapture(const app: string; output: TStrings; const workDir: string;

    var exitCode: longword; waitTimeout_sec: integer = 15; onNewLine: TDSiOnNewLineCallback

    = nil): cardinal;

  function  DSiExecuteAsUser(const commandLine, username, password: string;

    var winErrorCode: cardinal; const domain: string = '.';

    visibility: integer = SW_SHOWDEFAULT; const workDir: string = '';

    wait: boolean = false): cardinal; overload;

  function  DSiExecuteAsUser(const commandLine, username, password: string;

    var winErrorCode: cardinal; var processInfo: TProcessInformation;

    const domain: string = '.'; visibility: integer = SW_SHOWDEFAULT;

    const workDir: string = ''; wait: boolean = false;

    startInfo: PStartupInfo = nil): cardinal; overload;

  function  DSiGetProcessAffinity: string;

  function  DSiGetProcessAffinityMask: DWORD;

  function  DSiGetProcessID(const processName: string; var processID: DWORD): boolean;

  function  DSiGetProcessMemory(var memoryCounters: TProcessMemoryCounters): boolean;

    overload;

  function  DSiGetProcessMemory(process: THandle; var memoryCounters:

    TProcessMemoryCounters): boolean; overload;

  function  DSiGetProcessFileName(process: THandle; var processName: string): boolean;

  function  DSiGetProcessOwnerInfo(const processName: string; var user,

    domain: string): boolean; overload;

  function  DSiGetProcessOwnerInfo(processID: DWORD; var user,

    domain: string): boolean; overload;

  function  DSiGetProcessTimes(var creationTime: TDateTime; var userTime,

    kernelTime: int64): boolean; overload;

  function  DSiGetProcessTimes(process: THandle; var creationTime, exitTime: TDateTime;

    var userTime, kernelTime: int64): boolean; overload;

  function  DSiGetSystemAffinity: string;

  function  DSiGetSystemAffinityMask: DWORD;

  function  DSiGetThreadAffinity: string;

  function  DSiGetThreadAffinityMask: DWORD;

  function  DSiGetThreadTime: int64; overload;

  function  DSiGetThreadTime(thread: THandle): int64; overload;

  function  DSiGetThreadTimes(var creationTime: TDateTime; var userTime,

    kernelTime: int64): boolean; overload;

  function  DSiGetThreadTimes(thread: THandle; var creationTime, exitTime: TDateTime;

    var userTime, kernelTime: int64): boolean; overload;

  function  DSiImpersonateUser(const username, password: string;

    const domain: string = '.'): boolean;

  function  DSiIncrementWorkingSet(incMinSize, incMaxSize: integer): boolean;

  function  DSiIsDebugged: boolean;

  function  DSiLogonAs(const username, password: string;

    var logonHandle: THandle): boolean; overload;

  function  DSiLogonAs(const username, password, domain: string;

    var logonHandle: THandle): boolean; overload;

  function  DSiOpenURL(const URL: string; newBrowser: boolean = false): boolean;

  procedure DSiProcessThreadMessages;

  function  DSiRealModuleName: string;

  function  DSiRemoveAceFromDesktop(desktop: HDESK; sid: PSID): boolean;

  function  DSiRemoveAceFromWindowStation(station: HWINSTA; sid: PSID): boolean;

  function  DSiSetProcessAffinity(affinity: string): string;

  function  DSiSetProcessPriorityClass(const processName: string;

    priority: DWORD): boolean;

  function  DSiSetThreadAffinity(affinity: string): string;

  procedure DSiStopImpersonatingUser;

  function  DSiStringToAffinityMask(affinity: string): DWORD;

  function  DSiTerminateProcessById(processID: DWORD; closeWindowsFirst: boolean = true;

    maxWait_sec: integer = 10): boolean;

  procedure DSiTrimWorkingSet;

  function  DSiValidateProcessAffinity(affinity: string): string;

  function  DSiValidateProcessAffinityMask(affinityMask: DWORD): DWORD;

  function  DSiValidateThreadAffinity(affinity: string): string;

  function  DSiValidateThreadAffinityMask(affinityMask: DWORD): DWORD;

  procedure DSiYield;

{ Memory }

  procedure DSiFreePidl(pidl: PItemIDList);

  procedure DSiFreeMemAndNil(var mem: pointer);

  function  DSiGetGlobalMemoryStatus(var memoryStatus: TMemoryStatusEx): boolean;

{ Windows }

type

  TDSiExitWindows = (ewLogOff, ewForcedLogOff, ewPowerOff, ewForcedPowerOff, ewReboot,

    ewForcedReboot, ewShutdown, ewForcedShutdown);

                  

  function  DSiAllocateHWnd(wndProcMethod: TWndMethod): HWND;

  procedure DSiDeallocateHWnd(wnd: HWND);

  function  DSiDisableStandby: boolean;

  procedure DSiDisableX(hwnd: THandle);

  procedure DSiEnableX(hwnd: THandle);

  function  DSiExitWindows(exitType: TDSiExitWindows): boolean;

  function  DSiForceForegroundWindow(hwnd: THandle;

    restoreFirst: boolean = true): boolean;

  function  DSiGetClassName(hwnd: THandle): string;

  function  DSiGetProcessWindow(targetProcessID: cardinal): HWND;

  function  DSiGetWindowText(hwnd: THandle): string;

  procedure DSiProcessMessages(hwnd: THandle; waitForWMQuit: boolean = false);

  procedure DSiRebuildDesktopIcons;

  procedure DSiRefreshDesktop;

  procedure DSiSetTopMost(hwnd: THandle; onTop: boolean = true;

    activate: boolean = false);

{ Aero }

  function  DSiAeroDisable: boolean;

  function  DSiAeroEnable: boolean;

  function  DSiAeroIsEnabled: boolean;

{ Taskbar }

  function  DSiGetTaskBarPosition: integer;

{ Menus }

  function  DSiGetHotkey(const item: string): char;

  function  DSiGetMenuItem(menu: HMENU; item: integer): string;

{ Screen }

  procedure DSiDisableScreenSaver(out currentlyActive: boolean);

  procedure DSiEnableScreenSaver;

  function  DSiGetBitsPerPixel: integer;

  function  DSiGetBPP: integer;

  function  DSiGetDesktopSize: TRect;

  function  DSiIsFullScreen: boolean;

  procedure DSiMonitorOff;

  procedure DSiMonitorOn;

  procedure DSiMonitorStandby;

  function  DSiSetScreenResolution(width, height: integer): longint;

{ Rectangles }

  procedure DSiCenterRectInRect(const ownerRect: TRect; var clientRect: TRect);

  procedure DSiMakeRectFullyVisibleOnRect(const ownerRect: TRect; var clientRect: TRect);

{ Clipboard }

  function  DSiIsHtmlFormatOnClipboard: boolean;

  function  DSiGetHtmlFormatFromClipboard: string;

  procedure DSiCopyHtmlFormatToClipboard(const sHtml: string; const sText: string = '');

 

{ Information }

type

  TDSiBootType = (btNormal, btFailSafe, btFailSafeWithNetwork, btUnknown);

  TDSiWindowsVersion = (wvUnknown, wvWin31, wvWin95, wvWin95OSR2, wvWin98,

    wvWin98SE, wvWinME, wvWin9x, wvWinNT3, wvWinNT4, wvWin2000, wvWinXP,

    wvWinNT, wvWinServer2003, wvWinVista, wvWinServer2008, wvWinServer2008OrVistaSP1,

    wvWin7, wvWinServer2008R2, wvWin7OrServer2008R2);

  TDSiUIElement = (ueMenu, ueMessage, ueWindowCaption, ueStatus);

  function  DSiGetAppCompatFlags(const exeName: string): string;

  function  DSiGetBootType: TDSiBootType;

  function  DSiGetCompanyName: string;

  function  DSiGetComputerName: string;

  function  DSiGetDefaultBrowser: string;

  function  DSiGetDirectXVer: string;

  function  DSiGetDiskLabel(disk: char): string;

  function  DSiGetDiskSerial(disk: char): string;

  function  DSiGetDomain: string;

  function  DSiGetEnvironmentVariable(const envVarName: string): string;

  function  DSiGetFolderLocation(const CSIDL: integer): string;

  procedure DSiGetKeyboardLayouts(layouts: TStrings);

  function  DSiGetMyDocumentsFolder: string;

  function  DSiGetProgramFilesFolder: string;

  function  DSiGetRegisteredOwner: string;

  function  DSiGetSystemFolder: string;

  function  DSiGetSystemLanguage: string;

  function  DSiGetSystemVersion: string;

  function  DSiGetTrueWindowsVersion: TDSiWindowsVersion;

  function  DSiGetUserName: string;

  function  DSiGetUserNameEx: string;

  function  DSiGetWindowsFolder: string;

  function  DSiGetWindowsVersion: TDSiWindowsVersion;

  function  DSiInitFontToSystemDefault(aFont: TFont; aElement: TDSiUIElement): boolean;

  function  DSiIsAdmin: boolean;

  function  DSiIsAdminLoggedOn: boolean;

  function  DSiIsDiskInDrive(disk: char): boolean;

  function  DSiIsWinNT: boolean;

  function  DSiIsWow64: boolean;

  function  DSiVerifyPassword(const username, password: string;

    const domain: string = '.'): boolean;

{ Install }

  TDSiFwResolveConflict = (rcDuplicate, rcOverwrite, rcSkip);

  function  DSiAddApplicationToFirewallExceptionList(const entryName,

    applicationFullPath: string; resolveConflict: TDSiFwResolveConflict = rcDuplicate;

    description: string = ''; grouping: string = '';

    serviceName: string = ''; protocols: TDSiFwIPProtocols = [fwProtoTCP];

    localPorts: string = '*'; profiles: TDSiFwIPProfiles = [fwProfileAll]): boolean;

  function  DSiAddApplicationToFirewallExceptionListAdvanced(const entryName,

    applicationFullPath: string; resolveConflict: TDSiFwResolveConflict = rcDuplicate;

    description: string = ''; grouping: string = '';

    serviceName: string = ''; protocols: TDSiFwIPProtocols = [fwProtoTCP];

    localPorts: string = '*'; profiles: TDSiFwIPProfiles = [fwProfileAll]): boolean;

  function  DSiAddApplicationToFirewallExceptionListXP(const entryName,

    applicationFullPath: string; resolveConflict: TDSiFwResolveConflict = rcDuplicate;

    profile: TDSiFwIPProfile = fwProfileCurrent): boolean;

  function  DSiAddPortToFirewallExceptionList(const entryName: string;

    portNumber: cardinal): boolean;

  function  DSiAddUninstallInfo(const displayName, uninstallCommand, publisher,

    URLInfoAbout, displayVersion, helpLink, URLUpdateInfo: string): boolean;

  function  DSiAutoRunApp(const applicationName, applicationPath: string;

    enabled: boolean = true): boolean;

  procedure DSiCreateShortcut(const fileName, displayName, parameters: string;

    folder: integer= CSIDL_STARTUP; const workDir: string = '');

  function  DSiDeleteShortcut(const displayName: string;

    folder: integer = CSIDL_STARTUP): boolean;

  procedure DSiEditShortcut(const lnkName, fileName, workDir, parameters: string);

  function  DSiFindApplicationInFirewallExceptionListAdvanced(const entryName: string;

    var rule: OleVariant): boolean;

  function  DSiFindApplicationInFirewallExceptionListXP(const entryName: string;

    var application: OleVariant; profile: TDSiFwIPProfile = fwProfileCurrent): boolean;

  function  DSiGetLogonSID(token: THandle; var logonSID: PSID): boolean;

  function  DSiGetShortcutInfo(const lnkName: string; var fileName, filePath, workDir,

    parameters: string): boolean;

  function  DSiGetUninstallInfo(const displayName: string;

    out uninstallCommand: string): boolean;

  function  DSiIsAutoRunApp(const applicationname: string): boolean;

  function  DSiRegisterActiveX(const fileName: string; registerDLL: boolean): HRESULT;

  procedure DSiRegisterRunOnce(const applicationName,

    applicationPath: string);

  function  DSiRemoveApplicationFromFirewallExceptionList(const entryName,

    applicationFullPath: string): boolean;

  function  DSiRemoveApplicationFromFirewallExceptionListAdvanced(const entryName: string): boolean;

  function  DSiRemoveApplicationFromFirewallExceptionListXP(const applicationFullPath: string): boolean; overload;

  function  DSiRemoveApplicationFromFirewallExceptionListXP(const applicationFullPath: string;

    profile: TDSiFwIPProfile): boolean; overload;

  procedure DSiRemoveRunOnce(const applicationName: string);

  function  DSiRemoveUninstallInfo(const displayName: string): boolean;

  function  DSiShortcutExists(const displayName: string;

    folder: integer = CSIDL_STARTUP): boolean;

{ Time }

  TDSiTimer = class

  private

    dtEnabled     : boolean;

    dtInterval    : cardinal;

    dtOnTimer     : TNotifyEvent;

    dtTag         : longint;

    dtWindowHandle: HWND;

  protected

    procedure SetEnabled(value: boolean);

    procedure SetInterval(value: cardinal);

    procedure SetOnTimer(value: TNotifyEvent);

    procedure UpdateTimer;

    procedure WndProc(var msgRec: TMessage);

  public

    constructor Create(enabled: boolean = true; interval: cardinal = 1000; onTimer:

      TNotifyEvent = nil; tag: longint = 0);

    destructor  Destroy; override;

    property Enabled: boolean read dtEnabled write SetEnabled default true;

    property Interval: cardinal read dtInterval write SetInterval default 1000;

    property Tag: longint read dtTag write dtTag;

    property OnTimer: TNotifyEvent read dtOnTimer write SetOnTimer;

  end; { TDSiTimer }

  function  DSiDateTimeToFileTime(dateTime: TDateTime; var fileTime: TFileTime): boolean;

  //Following three functions are based on GetTickCount

  function  DSiElapsedSince(midTime, startTime: int64): int64;

  function  DSiElapsedTime(startTime: int64): int64;

  function  DSiElapsedTime64(startTime: int64): int64;

  function  DSiHasElapsed(startTime: int64; timeout_ms: DWORD): boolean;

  function  DSiHasElapsed64(startTime: int64; timeout_ms: DWORD): boolean;

  function  DSiFileTimeToDateTime(fileTime: TFileTime): TDateTime; overload;

  function  DSiFileTimeToDateTime(fileTime: TFileTime; var dateTime: TDateTime): boolean; overload;

  function  DSiFileTimeToMicroSeconds(fileTime: TFileTime): int64;

  function  DSiPerfCounterToMS(perfCounter: int64): int64;

  function  DSiPerfCounterToUS(perfCounter: int64): int64;

  function  DSiQueryPerfCounterAsUS: int64;

  function  DSiTimeGetTime64: int64;

  procedure DSiuSecDelay(delay: int64);

{ Interlocked }

function  DSiInterlockedDecrement64(var addend: int64): int64; register;

function  DSiInterlockedIncrement64(var addend: int64): int64; register;

function  DSiInterlockedExchangeAdd64(var addend: int64; value: int64): int64; register;

function  DSiInterlockedExchange64(var target: int64; value: int64): int64; register;

function  DSiInterlockedCompareExchange64(var destination: int64; exchange, comparand: int64): int64; register; overload;

function  DSiInterlockedCompareExchange64(destination: PInt64; exchange, comparand: int64): int64; register; overload;

{ DynaLoad }

  function  DSi9xNetShareAdd(serverName: PChar; shareLevel: smallint;

    buffer: pointer; size: word): integer; stdcall;

  function  DSi9xNetShareDel(serverName: PChar; netName: PChar;

    reserved: word): integer; stdcall;

  function  DSiCloseServiceHandle(hSCObject: SC_HANDLE): BOOL; stdcall;

  function  DSiCreateProcessAsUser(hToken: THandle;

    lpApplicationName, lpCommandLine: PChar; lpProcessAttributes,

    lpThreadAttributes: PSecurityAttributes; bInheritHandles: BOOL;

    dwCreationFlags: DWORD; lpEnvironment: pointer;

    lpCurrentDirectory: PChar; const lpStartupInfo: TStartupInfo;

    var lpProcessInformation: TProcessInformation): BOOL; stdcall;

  function  DSiCreateProcessWithLogonW(lpUsername, lpDomain, lpPassword: PWideChar;

    dwLogonFlags: DWORD; lpApplicationName, lpCommandLine: PWideChar;

    dwCreationFlags: DWORD; lpEnvironment: pointer; lpCurrentDirectory: PWideChar;

    const lpStartupInfo: TStartupInfoW; var lpProcessInformation: TProcessInformation): BOOL;

  function  DSiCreateEnvironmentBlock(var lpEnvironment: pointer; hToken: THandle;

    bInherit: BOOL): BOOL;

  function  DSiDestroyEnvironmentBlock(lpEnvironment: pointer): BOOL;

  function  DSiDwmEnableComposition(uCompositionAction: UINT): HRESULT; stdcall;

  function  DSiDwmIsCompositionEnabled(var pfEnabled: BOOL): HRESULT; stdcall;

  function  DSiEnumProcessModules(hProcess: THandle; lphModule: PModule; cb: DWORD;

    var lpcbNeeded: DWORD): BOOL; stdcall;

  function  DSiGetModuleFileNameEx(hProcess: THandle; hModule: HMODULE; lpFilename: PChar;

    nSize: DWORD): DWORD; stdcall;

  function  DSiGetProcAddress(const libFileName, procName: string): FARPROC;

  function  DSiGetProcessImageFileName(hProcess: THandle; lpImageFileName: PChar;

    nSize: DWORD): DWORD; stdcall;

  function  DSiGetProcessMemoryInfo(process: THandle; memCounters: PProcessMemoryCounters;

    cb: DWORD): boolean; stdcall;

  function  DSiGetTickCount64: int64; stdcall;

  function  DSiGetUserProfileDirectoryW(hToken: THandle; lpProfileDir: PWideChar;

    var lpcchSize: DWORD): BOOL; stdcall;

  function  DSiGlobalMemoryStatusEx(memStatus: PMemoryStatusEx): boolean; stdcall;

  function  DSiImpersonateLoggedOnUser(hToken: THandle): BOOL; stdcall;

  function  DSiIsWow64Process(hProcess: THandle; var wow64Process: BOOL): BOOL; stdcall;

  function  DSiLogonUser(lpszUsername, lpszDomain, lpszPassword: PChar;

    dwLogonType, dwLogonProvider: DWORD; var phToken: THandle): BOOL; stdcall;

  function  DSiNetApiBufferFree(buffer: pointer): cardinal; stdcall;

  function  DSiNetWkstaGetInfo(servername: PChar; level: cardinal;

    out bufptr: pointer): cardinal; stdcall;

  function  DSiNTNetShareAdd(serverName: PChar; level: integer; buf: PChar;

    var parm_err: integer): DWord; stdcall;

  function  DSiNTNetShareDel(serverName: PChar; netName: PWideChar;

    reserved: integer): DWord; stdcall;

  function  DSiOpenSCManager(lpMachineName, lpDatabaseName: PChar;

    dwDesiredAccess: DWORD): SC_HANDLE; stdcall;

  function  DSiRevertToSelf: BOOL; stdcall;

  function  DSiSetDllDirectory(path: PChar): boolean; stdcall;

  function  DSiSetSuspendState(hibernate: BOOL; forceCritical: BOOL = false;

    disableWakeEvent: BOOL = false): BOOL; stdcall;

  function  DSiSHEmptyRecycleBin(Wnd: HWND; pszRootPath: PChar;

    dwFlags: DWORD): HRESULT; stdcall;

  function  DSiWow64DisableWow64FsRedirection(var oldStatus: pointer): BOOL; stdcall;

  function  DSiWow64RevertWow64FsRedirection(const oldStatus: pointer): BOOL; stdcall;

{ Helpers }

function UTF8Encode(const ws: WideString): UTF8String;

function UTF8Decode(const sUtf: UTF8String): WideString;

Nenhum comentário:

Postar um comentário

Observação: somente um membro deste blog pode postar um comentário.

Max Gehringer