#147 problems with w32api includes

WSL
closed
Danny Smith
None
fixed
Known_bugs
2013-01-30
2002-06-02
Clive Nicolson
No

Recently I've been "porting" some Win32/Perl packages
to cygwin/Perl and have had to add __CYGWIN__
conditioned patches to overcome what I assume are
differences between native Win include files and those
provided by w32api.

I've not got access to native Win include files, so can
not work out what the extact problems are, but below
are 5 examples of the changes I've had to make.

I've included all the preceeding context as a aid.

The w32api maintainer is most likely to be in a better
position to fix these problems than I. I think that
items 4) and 5) maybe difficult as those string
declarations are most likely in <strings.h> on Win32
systems.

Clive

1)
#include <windows.h>
#ifdef __CYGWIN__
#include <wtypes.h>
#include <objbase.h>
#endif /* __CYGWIN__ */

2)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <winbase.h>
#ifdef __CYGWIN__
#include <winnt.h>

typedef ACE_HEADER *PACE_HEADER;
typedef ACCESS_ALLOWED_ACE *PACCESS_ALLOWED_ACE;
#endif /* __CYGWIN__ */

3)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <lmcons.h> /* LAN Manager common definitions */
#include <lmerr.h> /* LAN Manager network error
definitions */
#include <lmUseFlg.h>
#include <lmAccess.h>
#include <lmAPIBuf.h>
#undef LPTSTR
#define LPTSTR LPWSTR
#include <lmServer.h>
#include <lmwksta.h>
#undef LPTSTR
#define LPTSTR LPSTR
#ifdef __CYGWIN__
#include <winnls.h>
#endif

4)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#ifdef __CYGWIN__
WCHAR *wcschr(const WCHAR *, WCHAR);
#endif

5)
#ifdef __CYGWIN__
int _wcsicmp(const WCHAR *, const WCHAR *);
long _wtol(const WCHAR *);
#endif /* __CYGWIN__ */

===============The end==========================

Discussion

  • Earnie Boyd
    Earnie Boyd
    2002-06-03

    • assigned_to: earnie --> dannysmith
     
  • Earnie Boyd
    Earnie Boyd
    2002-06-03

    Logged In: YES
    user_id=15438

    I don't think your methods are valid. I'm passing to Danny to get his opinion.

     
  • Danny Smith
    Danny Smith
    2002-06-04

    Logged In: YES
    user_id=11494

    Thanks Earnie

    1) I think this is due to the fact that windows.h does not
    include ole2.h by default. Perhaps, with vtable-thunk
    implementation now default in C++, we should.

    2) I don't have a clue.
    including windows.h normally includes winnt.h
    (and winbase.h)
    What version of w32api are you using?

    3) Ditto. Maybe you've done something like this
    in an earlier header (copied from cygwin's winsup.h):
    #define WIN32_LEAN_AND_MEAN 1
    #define _WINGDI_H
    #define _WINUSER_H
    #define _WINNLS_H
    #define _WINVER_H
    #define _WINNETWK_H
    #define _WINSVC_H
    #include <windows.h>
    #include <wincrypt.h>
    #include <lmcons.h>
    #undef _WINGDI_H
    #undef _WINUSER_H
    #undef _WINNLS_H
    #undef _WINVER_H
    #undef _WINNETWK_H
    #undef _WINSVC_H

    4) Can't help you here. You can't include mingw headers
    if your using cygwin.
    This is in mingw's string.h:
    wchar_t* wcschr (const wchar_t*, wchar_t);
    It is not part of w32api

    5) same as 4

    Danny

     
  • Clive Nicolson
    Clive Nicolson
    2002-06-04

    Logged In: YES
    user_id=556789

    Thanks,

    I've discovered that I updated to the latest w32api while I
    was constructing my patches, so a couple of my problems have
    lessened.

    >1) I think this is due to the fact that windows.h does not
    >include ole2.h by default. Perhaps, with vtable-thunk
    >implementation now default in C++, we should.

    That would be much appreciated.

    >2) I don't have a clue.
    >including windows.h normally includes winnt.h (and winbase.h)
    >What version of w32api are you using?

    Ok, the <winnt.h> is not needed, but the PACE_HEADER and
    PACCESS_ALLOWED_ACE are! The latest version of w32api.

    Thanks
    Clive

     
  • Danny Smith
    Danny Smith
    2002-06-10

    • status: open --> closed-remind
     
  • Danny Smith
    Danny Smith
    2002-06-10

    Logged In: YES
    user_id=11494

    I think I've fixed 1) and 2) . I can't reproduce 3).
    4) and 5) are problems I can't fix. the prototypes are
    wrong anyway,

    So I'll close for now. Feel free to reopen if you can
    narrow down to a specific bug.

    Danny

     
  • Clive Nicolson
    Clive Nicolson
    2002-06-10

    Logged In: YES
    user_id=556789

    Thanks,

    Fixes for 1 and 2 are much appretiated, 3 seems to have been
    my problem
    and for 4 and 5 I've modified my prototypes.

    Clive

     
  • Earnie Boyd
    Earnie Boyd
    2013-01-30

    • labels: w32api (deprecated use WSL) -->
    • status: closed-remind --> closed
    • resolution: --> fixed
    • category: --> Known_bugs
    • milestone: Feature_requests --> WSL