how would i turn off a selected disk drive, like windows power managment does, i now have 4 drives and when i leave it on for long periods of time, i only use 1 for disk access for programs etc. i have code to turn off the floppy motor, perhaps similar coding to turn off disk motor.?any one know?
Posted on 2002-12-25 18:03:58 by Qages
Just Kidding But Have You Tried Unplugging It?

-HeXeN
Posted on 2002-12-25 18:35:10 by HeXeN
I would like to know the answer to Qages questions also.

Qages....could you post your code to turn off the floppy motor?

regards

:alright:
Posted on 2002-12-25 19:20:47 by IwasTitan
Kill_motor:
push dx
mov dx,0x3f2
xor al, al
out dx,al
pop dx
ret
Posted on 2002-12-25 20:24:43 by Qages

Just Kidding But Have You Tried Unplugging It?

-HeXeN

that would frease the system. and i would have to reboot :(
Posted on 2002-12-25 20:25:12 by Qages
Found this a while ago..

;******************************************************************************
title HDSLEEP - A simple virtual device driver example
;******************************************************************************
; Title: HDSLEEP.386 - Harddisk-Abschalt-Programm
; Module: HDSLEEP.ASM - Core code
; Version: 1.00
;******************************************************************************
; Functional Description:
; je nach Eintrag in HDSleepTimeOut=dddd in der [386enh]-Sektion
; in der SYSTEM.INI

.386p
;==============================================================================
; I N C L U D E S & E Q U A T E S
;==============================================================================
.XLIST
INCLUDE VMM.Inc
INCLUDE Debug.Inc
INCLUDE BlockDev.Inc
.LIST

HDSLEEP_Major_Ver equ 01h
HDSLEEP_Minor_Ver equ 00h
HDSLEEP_Device_ID equ Undefined_Device_ID

;==============================================================================
; V I R T U A L D E V I C E D E C L A R A T I O N
;==============================================================================

Declare_Virtual_Device HDSLEEP, HDSLEEP_Major_Ver, HDSLEEP_Minor_Ver,\
HDSLEEP_Control_Proc, HDSLEEP_Device_ID,\
BlockDev_Init_Order+16,,

;==============================================================================
; I N I T D A T A
;==============================================================================

VxD_IDATA_SEG
Keyname db "hdsleeptimeout",0 ;Eintrag in der [386enh]-Sektion

VxD_IDATA_ENDS

;==============================================================================
; N O N - P A G E A B L E D A T A
;==============================================================================

VxD_LOCKED_DATA_SEG
spm dd 60 ;Sekunden pro Minute (f?r MUL ben?tigt)
TimeOut dd 0 ;10 Minuten sind normal (wird gesetzt)
DecCnt dd 0 ;z?hlt die Sekunden abw?rts
RealProc dd ? ;beinhaltet Adresse der urspr?nglichen Funktion

VxD_LOCKED_DATA_ENDS

;==============================================================================
; I N I T C O D E
;==============================================================================

VxD_ICODE_SEG

BeginProc HDSLEEP_Device_Init
Trace_Out "HDSLEEP: Device_Init"
;Profilstring auslesen
mov eax,10 ;Minuten
xor esi,esi ;Standard-Sektion=[386enh]
mov edi,OFFSET32 Keyname
VMMCall Get_Profile_Decimal_Int
mul ;Sekunden draus machen
mov ,eax;Blocktreiber-Funktion anzapfen
mov eax,BlockDev_Send_Command
mov esi,OFFSET32 HookProc
VMMCall Hook_Device_Service
jc notinst
mov ,esi;
Timerproc anspringen, ist im gelockten Codesegment
jmp Timerproc
notinst:
;stc
ret
EndProc HDSLEEP_Device_Init

VxD_ICODE_ENDS

VxD_LOCKED_CODE_SEG

;==============================================================================
; N O N P A G E A B L E C O D E
;==============================================================================

BeginProc HDSLEEP_Control_Proc
Control_Dispatch Device_Init, HDSLEEP_Device_Init
clc
ret
EndProc HDSLEEP_Control_ProcBegin

Proc HookProc, High_Freq
Trace_Out "Festplatte: uuuUUUIII..."
push
pop
jmp
EndProc HookProc

BeginProc TimerProc
dec
jnz nonzero
Trace_Out "Festplatte: IIIiiiuuu..."
push ecx
xor ecx,ecx
VMMCall Begin_Critical_Section
pop ecx
mov ah,0e0h ;Kommando-Byte: standby immediate (sofort AUS)
wake: push edx
xor al,al
mov dx,01f6h
out dx,al ;out 1f6,00
mov al,ah
inc dx
out dx,al ;out 1f7,e0/10
mov al,10h
dec dx
out dx,al ;out 1f6,10
xchg al,ah
inc dx
out dx,al ;out 1f7,e0/10
pop edx VMMCall End_Critical_Section
nonzero: mov eax,1000 ;Millisekunden
xor edx,edx ;Keine Referenzdaten
mov esi,OFFSET32 TimerProc
VMMCall Set_Global_Time_Out
clc
ret
EndProc TimerProc

VxD_LOCKED_CODE_ENDS

END

;---------------------------------------------------------------------------
; End of File: HDSLEEP.asm
;---------------------------------------------------------------------------
Posted on 2002-12-26 05:31:06 by Guerrilla
does that work on nt/xp/2k?
Posted on 2002-12-26 14:28:50 by Qages
I really don't know, I've never tested it :grin:
Posted on 2002-12-26 14:35:24 by Guerrilla
That can't work on Win2k/XP as it's a VXD=/
Posted on 2002-12-28 07:17:09 by DZA
no VxDs on win2k/xp? really? - i didn't know, but i can't believe it.
why? and what's the replacement for VxDs? something has to be instead of them...?
Posted on 2002-12-28 13:33:05 by hartyl
because VxDs are sorta hackish, and the LE format has support for 16bit code -
which you wont see on NT. The replacement is KMDs - kernel mode drivers.
Usually they have .sys extension, but in reality it's just PEs that use a different
set of APIs (ie, you can't link to kernel32 and friends), and run ring0. There's also
the new Windows Driver Model, aka WDM, which I don't know much about.
Posted on 2002-12-28 13:40:43 by f0dder