نمایش نتایج 1 تا 40 از 122

نام تاپیک: مرجع توابع دلفی

Threaded View

پست قبلی پست قبلی   پست بعدی پست بعدی
  1. #17

    Load کردن Driver ها با کد نویسی !


    uses Winapi.WinSvc;

    function LoadDriver(const cpDriverPath: PChar; const cpDriverName: PChar): BOOL;
    var
    hSCService: SC_HANDLE;
    hSCManager: SC_HANDLE;
    lpServiceArgVectors: PWideChar;
    begin
    Result := True;
    lpServiceArgVectors := nil;
    try
    hSCManager := OpenSCManager(nil, nil, SC_MANAGER_ALL_ACCESS);
    if (hSCManager = 0) then
    Result := False;

    hSCService := CreateService(hSCManager, cpDriverName, cpDriverName,
    SERVICE_ALL_ACCESS, SERVICE_KERNEL_DRIVER, SERVICE_DEMAND_START,
    SERVICE_ERROR_NORMAL, cpDriverPath, nil, nil, nil, nil, nil);

    if (hSCService = 0) And (GetLastError = ERROR_SERVICE_EXISTS) then
    hSCService := OpenService(hSCManager, cpDriverName, SERVICE_ALL_ACCESS);

    if (hSCService = 0) then
    Result := False;

    if Not(StartService(hSCService, 0, lpServiceArgVectors)) then
    begin
    if (GetLastError() <> ERROR_SERVICE_ALREADY_RUNNING) then
    Result := False;
    end;

    finally
    CloseServiceHandle(hSCManager);
    CloseServiceHandle(hSCService);
    end;
    end;



    const
    DriverPath = 'E:\Test\';
    DriverName = 'BasicDriver.sys';
    begin
    if LoadDriver(DriverPath + DriverName, 'Test !!!!') then
    ShowMessage('Wooo');
    end;





    موفق باشید.
    آخرین ویرایش به وسیله بهروز عباسی : جمعه 03 خرداد 1392 در 18:49 عصر
    Everything that has a beginning has an end. ... The End?



قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •