Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How can i hideo or block access to drives?

Posted on 1998-03-08
1
Medium Priority
?
217 Views
Last Modified: 2010-04-06
How Can I hide or block access to floppy drive and Cd-Rom drive throught Delphi?
0
Comment
Question by:narabe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 8

Accepted Solution

by:
ZifNab earned 40 total points
ID: 1360271
Hi narabe,

Yo, just found out too. This should it be, but haven't tried it out fully yet.

I'm going to put also in my component TCDEvents. It's freeware and maybe something just for you? Have a look at it and let me know what you think about it. You can find it at Torry's or super delphi pages...

const
     VWIN32_DIOC_DOS_IOCTL = 1;
     VWIN32_DIOC_DOS_INT13 = 4;

procedure TForm1.Button1Click(Sender: TObject);
  type
   PDIOC_REG = ^TDIOC_Registers;
   TDIOC_Registers = record
     Reg_EBX, Reg_EDX, Reg_ECX, Reg_EAX,
     Reg_EDI, Reg_ESI, Reg_Flags : DWORD
   end;
Var I, W: dWord;
    WBuffer: array[0..512 * 18] of byte;
    Reg: TDIOC_Registers;
    Result: Boolean;
    cb: dword;
begin
  Device:= CreateFile('\\.\vwin32',0, FILE_SHARE_READ or
                      FILE_SHARE_WRITE, nil, 0,
FILE_FLAG_DELETE_ON_CLOSE, 0);
// Locking...

  reg.reg_EAX:= $440D;
  reg.reg_EBX:= $0000;  // BL $00 to $7F  for Floppy,  $80 to $FF for
Hard-disk
  reg.reg_ECX:= $084B;
  reg.reg_EDX:= $0000;
  Result:= DeviceIoControl(Device, VWIN32_DIOC_DOS_IOCTL, @reg,
sizeof(reg),
                           @reg, sizeof(reg), cb, nil);
  if ((Result = False) or ((reg.reg_Flags and $0001) = 1)) then
    ShowMessage('Lock failure...');

// Unlocking

  reg.reg_EAX:= $440D;
  reg.reg_EBX:= $0000;  // BL $00 to $7F  for Floppy,  $80 to $FF for
Hard-disk
  reg.reg_ECX:= $086B;
  reg.reg_EDX:= $0000;
  Result:= DeviceIoControl(Device, VWIN32_DIOC_DOS_IOCTL, @reg,
sizeof(reg),
                           @reg, sizeof(reg), cb, nil);
  if ((Result = False) or ((reg.reg_Flags and $0001) = 1)) then
    ShowMessage('Unlock failure...');

  CloseHandle(Device);

end;

See too: Interrupt 21h Function 440Dh Minor Code 6Bh  Unlock Physical
Volume, and
 Interrupt 21h Function 440Dh Minor Code 4Bh  Lock Physical Volume in
Win32.HLP

Good luck...

Regards, Zif.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question