🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.privacy.anon-server
Article #6097

Re: Scramdisk and MS Word

#6097
From: Anthony Naggs
Date: Sun, 22 Nov 1998 00:00
70 lines
3367 bytes
After much consideration  decided to share these wise words:
>>
>
>The offending line:
> SendMessage(HWND_BROADCAST,WM_DEVICECHANGE,32768,(long) &h);
>
>Was tried in SD to attempt to stop Explorer windows open when a container was
>mounted.  Unfortunately, this message (which was sent to all windows) hung
>Find Fast.

[I'm a little behind with my news reading ... some things never change!]

The source for 2.02c, which is still the latest available, has an
obvious bug with this code:

    DEV_BROADCAST_HDR h;
    h.dbch_size=sizeof(DEV_BROADCAST_HDR);
    h.dbch_devicetype=2; //DBT_DEVTYP_VOLUME;
    h.dbch_reserved=0; 

    if (mf->mountresult==3)
        //  drawwhichdevice=c+1;
    {
        SendMessage(HWND_BROADCAST,WM_DEVICECHANGE,32768,(long) &h); 
        SetTimer(hwnd,c+1,2000,NULL);  // wait for mount....
    }
    else 
        xShellExecute(hwnd, "open",IconExplore[c], NULL, NULL,
SW_SHOWNORMAL); 


DEV_BROADCAST_HDR is the common structure header for all
DBT_DEVICEARRIVAL notifications.  The code should instead be setting up
a DEV_BROADCAST_VOLUME structure, as implied by the DBT_DEVTYP_VOLUME
value set in the devicetype field.

The DEV_BROADCAST_VOLUME structure looks like this:
struct _DEV_BROADCAST_VOLUME { /* */
    DWORD       dbcv_size;
    DWORD       dbcv_devicetype;
    DWORD       dbcv_reserved;
    DWORD       dbcv_unitmask;
    WORD        dbcv_flags;
};

dbcv_flags should be set to DBTF_MEDIA.  dbcv_unitmask is a bit mask
indicating which volumes have changed, eg bit 0 (1) for drive A:, bit 2
(4) for drive C:, ...

I would've thought that the IFS would generate appropriate
WM_DEVICECHANGE messages without SD needing to do so.  (I'm not actually
running SD at the moment to check.)  But if not SD should surely be
broadcasting DBT_DEVICEREMOVAL when volumes are dismounted.

I shall update my PnPwatch [1] program to check the size value of the
data structures on such broadcasts.


Cheers,
      Anthony

1.  PnPwatch is free software that demonstrates how to parse
    WM_DEVICECHANGE broadcasts, and helps debug Plug'n'Play activity
    in Windows 95, 98 & NT.
    ftp://ftp.demon.co.uk/pub/ibmpc/win95/programming/pnpwat11.zip is
    the current version of my source & exe.  The updated pnpwat12.zip
    file will appear when the site administrator processes new uploads 
    during this week.
-- 
  BAD COMPUTER!  That's my registry file you've trashed.
Technical Details
Message-ID: <2aauyDAoS1V2EwfR@ubik.demon.co.uk>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.security.pgp.mbox.zip!not-for-mail
References: <19981108042522.12771.qmail@hades.rpini.com> <3647dad1.1512704@news.demon.co.uk> <36497ed1.834783@nntp.jaring.my> <72c9o6$oie$1@nnrp1.dejanews.com>

Show Full Headers
Complete Article Headers
Message-ID: <2aauyDAoS1V2EwfR@ubik.demon.co.uk>
Subject: Re: Scramdisk and MS Word
Date: Sun, 22 Nov 1998 00:00:00 +0000
From: Anthony Naggs <amn@ubik.demon.co.uk>
References: <19981108042522.12771.qmail@hades.rpini.com> <3647dad1.1512704@news.demon.co.uk> <36497ed1.834783@nntp.jaring.my> <72c9o6$oie$1@nnrp1.dejanews.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.security.pgp.mbox.zip!not-for-mail
X-Deja-AN: 414377015
X-NNTP-Posting-Host: ubik.demon.co.uk:194.222.125.229
X-Complaints-To: abuse@demon.net
X-Trace: news.demon.co.uk 911705867 nnrp-10:13450 NO-IDENT ubik.demon.co.uk:194.222.125.229
Organization: Ubikuity
MIME-Version: 1.0
Newsgroups: alt.privacy.anon-server,alt.security.pgp