Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

SysDevice Disable HowTo?

[es] :: Pascal / Delphi / Kylix :: SysDevice Disable HowTo?

[ Pregleda: 3385 | Odgovora: 6 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

_v!rus_
BGD

Član broj: 40451
Poruke: 313
*.vdial.verat.net.



+1 Profil

icon SysDevice Disable HowTo?13.03.2005. u 19:48 - pre 231 meseci
Ima li neko ideju kako mogu da disable-ujem odredjeni device u sistemu
(eq. u Control Panel->DeviceManager->NekiDevice->BtnDisable) ?

Treba da programski onemogucim pristup mreznoj karti i eventualnom kablovskom modemu u zavisnosti od tamo nekih parametara mog programa.
 
Odgovor na temu

vlaiv
Vladimir Vlaisavljevic
Novi Sad

Član broj: 15993
Poruke: 352
*.neobee.net.



+1 Profil

icon Re: SysDevice Disable HowTo?13.03.2005. u 22:35 - pre 231 meseci
Pogledaj MSDN pod:

Windows base services\device management ...


Tamo ima razno raznih funkcija za listanje device-ova razlicite klase, dobijanje interface-a od datih device-a i sl ... mozda postoji neki Interface koji ima date funkcije ... (nisam detaljno gledao)
 
Odgovor na temu

vlaiv
Vladimir Vlaisavljevic
Novi Sad

Član broj: 15993
Poruke: 352
*.neobee.net.



+1 Profil

icon Re: SysDevice Disable HowTo?13.03.2005. u 22:38 - pre 231 meseci
Pogledaj SetupDiChangeState ....


Citat:

To enable/disable a device in the current hardware profile, set the DICS_FLAG_CONFIGSPECIFIC flag in the SP_PROPCHANGE_PARAMS. To enable/disable a device globally, such as in both the docked and undocked hardware profiles, set the DICS_FLAG_GLOBAL flag.

This function does the following:

DICS_ENABLE
Loads the drivers for the device and starts the device, if possible. If the function is not able to start the device, it sets the DI_NEEDREBOOT flag for the device which indicates to the initiator of the property change request that they must prompt the user to reboot the machine.
DICS_DISABLE
Disables the device. If the device is disableable but this function cannot disable the device dynamically, this function marks the device to be disabled the next time the machine reboots.
DICS_PROPCHANGE
Removes and reconfigures the device so the new properties can take effect. This flag typically indicates that a user has changed a property on a Device Manager property page for the device. The PnP Manager directs the drivers for the device to remove their device objects and then the PnP Manager reconfigures and restarts the device.
 
Odgovor na temu

_v!rus_
BGD

Član broj: 40451
Poruke: 313
*.vdial.verat.net.



+1 Profil

icon Re: SysDevice Disable HowTo?13.03.2005. u 23:18 - pre 231 meseci
Hvala puno, pogledacu samo da nadjem MSDN, imam na VS6 diskovima, samo se bojim da je mnogo mator.

Mozda ima i drugi nacin programskog onemogucavanja mreze (npr. stopiranjem nekog od kljucnih WinNT servisa za pristup mrezama) ali ni to ne znam kako.

Btw. idealan slucaj sam imao koriscenjem programa WinGate (ruterski program), tu prepravkom samo jednog flaga u registry-u MOMENTALNO se onemogucava internet, samo ovo nije situacija za WinGate...
 
Odgovor na temu

sasas
Saša Slavnić
radim za neke švabe

Član broj: 35478
Poruke: 617
*.zaslon-telecom.si.



Profil

icon Re: SysDevice Disable HowTo?14.03.2005. u 09:07 - pre 231 meseci
Za stopiranje servisa možeš koristiti nešto ovako:

Code:

uses ...WinSvc...
.
.
.
var
  ch: array[0..512] of char;
  w: cardinal;
  manager, service: SC_Handle;
  status: SERVICE_STATUS;
begin
  w := sizeof(ch);
  GetComputerName(ch, w);

  manager := OpenSCManager(ch, nil, SC_MANAGER_ALL_ACCESS);
  service := OpenService(manager, PChar('Themes'), SERVICE_ALL_ACCESS);
  if ControlService(service, SERVICE_CONTROL_STOP, status) then 
    ShowMessage('Zaustavio servis');
end;


Ovaj kood zaustavlja servis 'Themes', umesto toga staviš ime nekog mrežnog servisa (ime koje vidiš u spisku servisa je 'Display name', pravo ime servisa vidiš kad otvoriš 'properities' servisa).

Malecka napomena: moguće je da i neki DB servisi (verovatno i neki drugi) koriste mrežne interfejse (zavisi kako se i šta koristi) pa treba biti oprezan sa isključivanjem mrežnih servisa.

A ako se ipak odlučiš za čačkanje po drajverima, srećno (you're gonna need it...)

ss.
When something is hard to do, then it's not worth doing.
 
Odgovor na temu

_v!rus_
BGD

Član broj: 40451
Poruke: 313
*.vdial.verat.net.



+1 Profil

icon Re: SysDevice Disable HowTo?14.03.2005. u 10:50 - pre 231 meseci
Tnx, radi, samo da proverim radi li i sa non-admin korisnicima.

Citat:
A ako se ipak odlučiš za čačkanje po drajverima, srećno (you're gonna need it...)

I ja bih to izbegao, ali npr. program ProgDVB (za digit. sat. TV) ima opcije Start/Stop device koji upravo radi ono sto meni treba (+ sto sat kartica se registruje kao mrezna kartica...)
 
Odgovor na temu

Brkic

Član broj: 55360
Poruke: 1222
*.dynamic.sbb.co.yu.



Profil

icon Re: SysDevice Disable HowTo?17.08.2007. u 23:27 - pre 202 meseci
sasas tvoj primer funcionise OK e sada ima jedno pitanje...

probao sam nesto da izmenim tvoj kod ali mi nije uspelo,
moze li se menjati "startup type" da se stavi na disable,manual,automatic ??
 
Odgovor na temu

[es] :: Pascal / Delphi / Kylix :: SysDevice Disable HowTo?

[ Pregleda: 3385 | Odgovora: 6 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.