🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #17285

Re: Locking drives and folders

#17285
From: Early Ehlinger
Date: Thu, 27 Mar 2003 21:25
28 lines
1807 bytes
"Mehmet Caner" <fekinci37@hotmail.com> wrote:
>   fResult = DeviceIoControl (hDevice, VWIN32_DIOC_DOS_IOCTL, &regs,
>                              sizeof(regs), &regs, sizeof(regs), &cb, 0);
>
>   if (!fResult || (regs.reg_Flags & 0x0001)) return FALSE;
>   else return fResult;
> }

> 2.  I tried CreateFile and DeviceIoControl functions for locking folders,
> but it failed. Any tip please?

Are you sure DeviceIoControl failed?  DeviceIoControl returns an HRESULT.

From MSDN:

    If the method succeeds, the return value is S_OK.

From winerror.h:

    #define S_OK ((HRESULT)0x00000000L)

Therefore using !fResult to check the return from DeviceIoControl is going
to make you think that it failed when it really succeeded.


--
-- Early Ehlinger CEO, ResPower Inc - Toll-Free : 866-737-7697
-- www.respower.com -- 500+ GHz Supercomputer Starting At USD$0.50/GHz*Hour
Technical Details
Message-ID: <3e836c43@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3e82f3da@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,7f5c670ff7b6ca8f
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-03-27 13:28:04 PST
From: "Early Ehlinger" <early@respower.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3e82f3da@newsgroups.borland.com>
Subject: Re: Locking drives and folders
Date: Thu, 27 Mar 2003 15:25:13 -0600
Lines: 31
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
NNTP-Posting-Host: 206.166.224.226
Message-ID: <3e836c43@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1048800323 206.166.224.226 (27 Mar 2003 13:25:23 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail