• UAC

    Posted on August 26th, 2010 Alan No comments

    User Access Control has been causing me fits.
    With UAC on, if you attempt to open a registry key in the LOCAL_MACHINE hive and you specify WRITE permissions, it will fail (that was a bug on my part).
    Something else to consider is that processes of different  integrity levels cannot send/post messages to each other.  This post has a good explanation of that and a work around.

  • Mercurial For Source Control

    Posted on March 19th, 2010 Alan No comments

    It appears that Subversion is no longer where it’s at.  We now have Mercurial.

    Joel has a nice tutorial f or Mercurial.

    There is TortoiseHG for Explorer Integration which is what I installed which included Mercurial.

    Two plugins for Visual Studio exists as well: VisualHG, hgscc

    Update:  I was unable to get hgscc to work on Windows 7 VS 2008.  Any attempts to add a file from  within VS resulted in a generic error  message.  I uninstalled hgscc by right clicking the .msi install file and selecting uninstall

  • C Run-Time Error R6025 pure virtual function call

    Posted on March 3rd, 2010 Alan No comments

    I did a bad bad thing.

    Not so bad.  Calling a virtual pure function using a pointer to the abstract base class, or calling  it before the derived class has been initialized (in the constructor of the abstract class for example), is a no no.  I did the latter.

    Here is Microsoft’s explanation:

    No object has been instantiated to handle the pure virtual function call. This error is caused by calling a virtual function in an abstract base class through a pointer which is created by a cast to the type of the derived class, but is actually a pointer to the base class. This can occur when casting from a void* to a pointer to a class when the void* was created during the construction of the base class.

    And an explanation and example of the exact thing I did:

       /* Compile options needed: none
       */ 
    
       class A;
    
       void fcn( A* );
    
       class A
       {
       public:
           virtual void f() = 0;
           A() { fcn( this ); }
       };
    
       class B : A
       {
           void f() { }
       };
    
       void fcn( A* p )
       {
           p->f();
       }
    
       // The declaration below invokes class B's constructor, which
       // first calls class A's constructor, which calls fcn. Then
       // fcn calls A::f, which is a pure virtual function, and
       // this causes the run-time error. B has not been constructed
       // at this point, so the B::f cannot be called. You would not
       // want it to be called because it could depend on something
       // in B that has not been initialized yet.
    
       B b;
    
       void main()
       {
       }

    I was actually able to make the following adjustment:

    Before:

    A:A()
    {
    VirtualPureFunction();
    }

    B:B() : A()
    {
    }

    After:

    A:A()
    {
    // VirtualPureFunction(); //  Don’t call  here.  Derived object not guaranteed to be intialized
    }

    B:B() : A()
    {
    VirtualPureFunction(); // Safe to call here since A() constructor already called
    }

  • Writing portable code

    Posted on January 17th, 2010 Alan No comments

    Mozilla C++ Portability Guide – for portability across ALL C++ compilers

  • Registry Reflection (WOW6432)

    Posted on December 7th, 2009 Alan No comments

    Supporting 32-bit & 64-bit applications can be a bit hairy.  In regards to the Registry, Windows 7 washes it’s hands of the Registry Reflection business previously supported.

  • WINVER not defined, defaulting to…

    Posted on September 25th, 2009 Alan No comments

    WINVER is a symbol that your Windows application is suppose to define to declare the oldest version of the OS that your application  is designed to run on.  If you do not define it, you will get a warning and it will default to the OS on which you are building.

    ox501 is the value to use for  Windows  XP.   You can define it in stdafx.h or in the preprocessor settings of your project.

    Read more about it at here.

  • Can’t login to mac from Vista

    Posted on September 9th, 2009 Alan No comments

    For sometime I’ve had problems connecting from my Vista laptop to my MacBook Pro.  I’ve only been  able  to connect  the other way.  Finally a solution.

    This thread recommends the following:

    On the start menu in the search field type “gpedit.msc”, hit enter. This will open the group policy editor.

    Go to “Computer Configruation” –> “Windows Settings” –> “Security Settings” –> “Local Policies” –> “Security Options”

    In the pane on the right side of the screen, select “Network Security: LAN Manager Authentication level.” By default this read “Send NTLMv2 response only.”
    Change “Send NTLMv2 respone only” to “Send LM & NTLM — use NTLMv2 session security if negotiated”

    restart the client

    If you use a famillial vista try this.  You must modify the BDR

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
    DWORD named : LmCompatibilityLevel must set to 1

  • NASM

    Posted on July 23rd, 2009 Alan No comments

    Just some links to NASM, an opensource assembler, which we are investigating at work to maintain our cross platform assembler code.

    NASM Home Page

    General NASM Guide

    Sample Code

    Examples

    Tips

    XCode Custom Target Example

  • unresolved externals and function signatures

    Posted on June 2nd, 2009 Alan No comments

    Build issues can be extremely aggravating and hard to track down.  I spent quite a bit of time  tracking down a link error where everything seemed in order.  Function declaration and implementation of a library function matched the call in my application.  After much trial and error I decided to get forensic on the compiler.  I looked at the mangled function signature of the  library file (dropped the .lib file into Visual Studio) and compared it with the mangled function signature in the output window where it was reporting an unresolved external.  I used the command line program undname to show me the user-friendly function signatures and the difference was one used __cdecl and the other used __stdcall.  I was then able to find that my application was using the C/C++…Advanced…Calling Convention…__stdcall (/Gz) whereas the library was using __cdecl (/Gd).  Comparing file signatures between what was actually compiled into the library and what is expected in the application can expose several inconsistant settings. Another one might be the General…Character Set settings.

  • CGI programming

    Posted on April 8th, 2009 Alan No comments

    I’ve never had an opportunity to work with CGI until now.  CGI is defined on wikipedia this way:

     

    The Common Gateway Interface (CGI) is a standard protocol for interfacing external application software with an information server, commonly a web server.

    The task of such an information server is to respond to requests (in the case of web servers, requests from client web browsers) by returning output. Each time a request is received, the server analyzes what the request asks for, and returns the appropriate output. The two simplest ways for the server to do this, are the following:

    • if the request identifies a file stored on disk, return the contents of that file;
    • if the request identifies an executable command and possibly arguments, run the command and return its output

    CGI defines a standard way of doing the second. It defines how information about the server and the request is passed to the command in the form of arguments and environment variables, and how the command can pass back extra information about the output (such as the type) in the form of headers.

     

    Here is a great getting started article on CGI.

    Methods GET and POST in HTML forms – what’s the difference?

    Form Post Tester/Viewer