Volleynerd Knowledge Base

Monday, June 30, 2003


MIDL and Enum Name-Mangling

I've gotten obscure build errors when building our SFP stuff with a bunch of dependent IDL (MIDL) files that contain ENUMs. A "deja" search finally set me straight - figured out how to avoid this name mangling issue...

We start with something like this in IDL:
typedef enum

{
SFP_STATE_IDLE = 0x00000000,
SFP_STATE_UPDATECHECK_BUSY = 0x00000001,
SFP_STATE_INSTALL_BUSY = 0x00000002
} SFP_STATE;
Then a method somewhere that uses this enum:
HRESULT State([out, retval] SFP_STATE *pVal);

The Problem
When calling code uses #import on this generated type library, you end up with something like this in the .TLH file:

typedef enum __MIDL___MIDL_itf_UpdateAdvisor_0257_0003 SFP_STATE;
enum __MIDL___MIDL_itf_UpdateAdvisor_0257_0003;
...
...
enum __MIDL___MIDL_itf_UpdateAdvisor_0257_0003
{
SFP_STATE_IDLE = 0,
SFP_STATE_UPDATECHECK_BUSY = 1,
SFP_STATE_INSTALL_BUSY = 2
};


If you use this #import statement in more than one client file/project, you may get multiply defined symbols. The trick to getting around this is to use the "exclude" modifier on the #import in subsequent files/projects. The problem I've had is what to exclude. The multiply defined symbol is really this enum with a big mangled name.

You can exclude by referring to this mangled name:
exclude( "__MIDL___MIDL_itf_vzInstall_0263_0003"),
but this is not optimal. You see, this symbol is *sometimes* mangled to slightly different numeric codes on different machines! I haven't pinpointed where the generated number comes from, especially the 0263 portion (the part that changes on various machines) in the above name. At work here, almost all machines come up with 0263, but then on a new laptop with a fresh install of the VS tools, it generates as 0264. So....how to avoid this constant chase of the mangled names...

The Solution
Thanks to this thread (search google with "#import" enum generated group:microsoft.public.* if the link doesn't work), I found a slightly different way to define the enums in IDL, to avoid the mangling all together.
typedef [public] enum eSfpState

{
SFP_STATE_IDLE = 0x00000000,
SFP_STATE_UPDATECHECK_BUSY = 0x00000001,
SFP_STATE_INSTALL_BUSY = 0x00000002
} SFP_STATE;
Notice the [public] enum eSfpState difference from the original way of describing.

This results in the .tlh having a nicer set of #defines:
typedef enum eSfpState SFP_STATE;

enum eSfpState;
...
...
enum eSfpState
{
SFP_STATE_IDLE = 0,
SFP_STATE_UPDATECHECK_BUSY = 1,
SFP_STATE_INSTALL_BUSY = 2
};


Now you leave the method signature the same in IDL:
HRESULT State([out, retval] SFP_STATE *pVal);
And the caller still uses SFP_STATE as the enum parameter type, and all is well in the world !!!

Wahoo!!




Netflix for Video Games

Rent video games via internet, have a queue of ones you want, etc.
$22/mo
Gamefly.com



Saturday, June 28, 2003


Whole House Video Distribution

Finally, a decent overview article about all this.
SMARTHOME - X10, Remote Security, Video Controls, Wireless Systems
But, they don't get into the actual "coax-to-RCA and back-again" issues that I'm having.



Open Source IM Client

Is this any better/different than Trillian? The tout "many common futures" as well as other unique features.

SourceForge.net:
Project Info - Gaim





Remote Control Machine

As seen on The Screen Savers:
SourceForge.net: Project Info - TightVNC Remote control to Windows and Linux.
Funny, the dude said MS has some verbage in the license agreement that you can't "control" the mouse from any non-MS programs. (Just monopoly on RemoteDesktop, etc)



National Do Not Call Registry

This is all over the news these days, just opened this week.
Just so I remember, registered using standard yahoo email address. (Home phone and 2 cell phones)

Register here


Adelphia Cable HDTV


Apparently, Adelphia is starting to rollout HiDef tv to select markets. Damnit -- not in Carlsbad yet!? ;-(

Questions:
  • what hardware to decode HD?
  • what channels?
  • cost?


keywords: HD HiDef High Definition HDTV



Wednesday, June 25, 2003


ATL headers with DDK are not mainstream. MS recommends only using them if you are doing driver development.

We found some differences in the handling of CSimpleArray -- uses address-of operator & when doing Add on array. When storing COM smart pointers in the array, address-of operator calls Release( ) on the pointer first -- NOT GOOD.

DDK docs that describe the ATL headers here

excerpt here:


Included ATL Headers
The version of ATL that ships with this Windows 2000 DDK is not the same as the Visual C++ version and should only be used for driver development. General purpose ATL source code is available with your normal Visual C++ installation.




Tuesday, June 24, 2003


Activate NetMeeting in Windows XP
apparently the guts are installed, but there's no way to get to it until you do this.

Start, Run, "conf". walk through wizard steps and it will be there



Tuesday, June 17, 2003


Hacking - Tehnically Speaking. Guest on The Screen Savers. His web site here.
Ejovi Nuwere



Get Started with Digital Photography
Articles from Microsoft about basic digital photography.



Monday, June 16, 2003


Sunday, June 15, 2003


Spot on The Screen Savers about packet sniffing. Kevin Rose shows the tool called Iris. Not only a packet sniffer, but recreates the packets and shows you the native application (web browser, even Outlook email!).

Bummer, it's apparently $1000, but there's a 15 day trial.

Some suggestions to protect against this sniffing:
- Trillian Pro, offers encryption
- Encrypt your email, using something like PGP
- Hushmail is a free, web-based encrypted email service

Leo also notes that cable modems are inherently on a LAN with your neighborhood. Depending on the setup by the cable company, you may be seeing packets destined for your neighbors. SOME cable companies are changing to *switches* to help segment the traffic, but not all. Hmmm...doubtful Adelphia is doing this...



Thursday, June 12, 2003


Collection of Multiple Dispatch Implementations
Chris Sells

MVP VC++ FAQ has some thoughts about this too.

keywords: IDispatch multiple inheritance inherit



Wireless Links


NetStumbler
Access Point coverage, and a whole lot more...

War Driving
driving around the city, looking for access points! :)

Encryption Key Recovery Tool (Really, a way to hack the WEP encryption key?)

keywords: wireless, acess point, dlink, wardriving, war driving



Wednesday, June 11, 2003


Tuesday, June 10, 2003


The Screen Savers - Hacking and Tracking


ASTALAVISTA SECURITY GROUP Kevin Rose (The Screen Savers hacker) recommended this site for all underground searching.

Yoshi's list of mod sites:

Sarah Lane -- NeoTrace, a tool to track back to an ISP for a given poster, user, etc.



Thursday, June 05, 2003


MPEG-4: Movie Encoding Guide Be sure to go down to the bottom and select other parts of the Table of Contents. There are a lot of good articles here...



Monday, June 02, 2003


Microsoft Baseline Security Analyzer
Scan for "common system misconfigurations" in the following products: Windows 2000, XP, IIS, SQL Server 7.0 and 2000



Sunday, June 01, 2003


Perl for IIS


May want to install Perl on a Windows IIS machine to run the Replay TV Recording Scheduler.
ActiveState has an install for this here.
And some dude's instructions for all this.



Home