Differences From Artifact [32515530001c4a7e]:
- File        
src/win32/dde.d
- 2011-02-23 12:53:16 - part of checkin [c2b7a98c21] on branch trunk - Initial import (user: kinaba) [annotate]
 
 
To Artifact [958265cdfd657f8f]:
- File        
src/win32/dde.d
- 2015-04-21 10:46:55 - part of checkin [4e2933c620] on branch trunk - Rebased to the latest verson dmd 2.067. Not yet verified the outcome. (user: kinaba) [annotate]
 
 
                                                                                        >     1  /***********************************************************************\
                                                                                        >     2  *                                 dde.d                                 *
                                                                                        >     3  *                                                                       *
                                                                                        >     4  *                       Windows API header module                       *
                                                                                        >     5  *                                                                       *
                                                                                        >     6  *                 Translated from MinGW Windows headers                 *
                                                                                        >     7  *                           by Stewart Gordon                           *
                                                                                        >     8  *                                                                       *
                                                                                        >     9  *                       Placed into public domain                       *
                                                                                        >    10  \***********************************************************************/
    1  module win32.dde;                                                                     11  module win32.dde;
                                                                                        >    12  pragma(lib, "user32.lib");
    2                                                                                   |    13  
    3  // Translated from Microsoft Platform SDK August 2001 Edition                    <
    4  // by Y.Tomino                                                                   <
    5                                                                                   <
    6                                                                                   <
    7  // #ifndef _DDEHEADER_INCLUDED_                                                  <
    8  // #define _DDEHEADER_INCLUDED_                                                  <
    9                                                                                   <
   10  // #if _MSC_VER > 1000                                                           <
   11  // #pragma once                                                                  <
   12  // #endif                                                                        <
   13                                                                                   <
   14  // #ifndef _WINDEF_                                                              <
   15  import win32.windef;                                                             |    14  private import win32.windef;
   16  // #endif                                                                        <
   17                                                                                   |    15  
   18  // #ifdef __cplusplus                                                            <
   19  // extern "C" {                                                                  <
   20  // #endif                                                                        <
   21                                                                                   <
   22  enum : uint { WM_DDE_FIRST = 0x03E0 }                                            |    16  enum : uint {
                                                                                        >    17          WM_DDE_FIRST     = 0x03E0,
   23  const uint WM_DDE_INITIATE = WM_DDE_FIRST;                                       |    18          WM_DDE_INITIATE  = WM_DDE_FIRST,
   24  const uint WM_DDE_TERMINATE = WM_DDE_FIRST+1;                                    |    19          WM_DDE_TERMINATE,
   25  const uint WM_DDE_ADVISE = WM_DDE_FIRST+2;                                       |    20          WM_DDE_ADVISE,
   26  const uint WM_DDE_UNADVISE = WM_DDE_FIRST+3;                                     |    21          WM_DDE_UNADVISE,
   27  const uint WM_DDE_ACK = WM_DDE_FIRST+4;                                          |    22          WM_DDE_ACK,
   28  const uint WM_DDE_DATA = WM_DDE_FIRST+5;                                         |    23          WM_DDE_DATA,
   29  const uint WM_DDE_REQUEST = WM_DDE_FIRST+6;                                      |    24          WM_DDE_REQUEST,
   30  const uint WM_DDE_POKE = WM_DDE_FIRST+7;                                         |    25          WM_DDE_POKE,
   31  const uint WM_DDE_EXECUTE = WM_DDE_FIRST+8;                                      |    26          WM_DDE_EXECUTE,
   32  const uint WM_DDE_LAST = WM_DDE_FIRST+8;                                         <
                                                                                        >    27          WM_DDE_LAST      = WM_DDE_EXECUTE
   33                                                                                   |    28  }
                                                                                        >    29  
   34  struct _0 {                                                                      |    30  struct DDEACK {
   35  // #ifndef _MAC                                                                  <
   36  // unsigned short bAppReturnCode:8,                                              |    31          ubyte bAppReturnCode;
                                                                                        >    32          ubyte _bf;
                                                                                        >    33  
                                                                                        >    34          ubyte reserved() { return cast(ubyte) (_bf & 0x3F); }
                                                                                        >    35          bool  fBusy()    { return cast(bool)  (_bf & 0x40); }
                                                                                        >    36          bool  fAck()     { return cast(bool)  (_bf & 0x80); }
                                                                                        >    37  
   37  // reserved:6,                                                                   |    38          ubyte reserved(ubyte r) {
                                                                                        >    39                  _bf = cast(ubyte) ((_bf & ~0x3F) | (r & 0x3F));
                                                                                        >    40                  return cast(ubyte)(r & 0x3F);
                                                                                        >    41          }
                                                                                        >    42  
                                                                                        >    43          bool fBusy(bool f) { _bf = cast(ubyte) ((_bf & ~0x40) | (f << 6)); retur
                                                                                        >    44          bool fAck(bool f)  { _bf = cast(ubyte) ((_bf & ~0x80) | (f << 7)); retur
                                                                                        >    45  }
                                                                                        >    46  
                                                                                        >    47  struct DDEADVISE {
   38  // fBusy:1,                                                                      |    48          ushort _bf;
   39  // fAck:1;                                                                       |    49          short  cfFormat;
   40  // #else                                                                         <
                                                                                        >    50  
   41  // ...                                                                           |    51          ushort reserved()  { return cast(ushort) (_bf & 0x3FFF); }
   42  // #endif                                                                        |    52          bool   fDeferUpd() { return cast(bool)   (_bf & 0x4000); }
                                                                                        >    53          bool   fAckReq()   { return cast(bool)   (_bf & 0x8000); }
                                                                                        >    54  
                                                                                        >    55          ushort reserved(ushort r) {
                                                                                        >    56                  _bf = cast(ushort) ((_bf & ~0x3FFF) | (r & 0x3FFF));
                                                                                        >    57                  return cast(ushort)(r & 0x3FFF);
                                                                                        >    58          }
                                                                                        >    59  
                                                                                        >    60          bool   fDeferUpd(bool f) { _bf = cast(ushort) ((_bf & ~0x4000) | (f << 1
                                                                                        >    61          bool   fAckReq(bool f)   { _bf = cast(ushort) ((_bf & ~0x8000) | (f << 1
                                                                                        >    62  }
                                                                                        >    63  
                                                                                        >    64  struct DDEDATA {
                                                                                        >    65          ushort _bf;
                                                                                        >    66          short  cfFormat;
                                                                                        >    67          byte   _Value;
                                                                                        >    68  
                                                                                        >    69          ushort unused()    { return cast(ushort) (_bf & 0x0FFF); }
                                                                                        >    70          bool   fResponse() { return cast(bool)   (_bf & 0x1000); }
                                                                                        >    71          bool   fRelease()  { return cast(bool)   (_bf & 0x2000); }
                                                                                        >    72          bool   reserved()  { return cast(bool)   (_bf & 0x4000); }
                                                                                        >    73          bool   fAckReq()   { return cast(bool)   (_bf & 0x8000); }
                                                                                        >    74  
                                                                                        >    75          byte*  Value() { return &_Value; }
                                                                                        >    76  
                                                                                        >    77          ushort unused(ushort r) {
                                                                                        >    78                  _bf = cast(ushort) ((_bf & ~0x0FFF) | (r & 0x0FFF));
                                                                                        >    79                  return cast(ushort)(r & 0x0FFF);
                                                                                        >    80          }
                                                                                        >    81  
                                                                                        >    82          bool   fResponse(bool f) { _bf = cast(ushort) ((_bf & ~0x1000) | (f << 1
                                                                                        >    83          bool   fRelease(bool f)  { _bf = cast(ushort) ((_bf & ~0x2000) | (f << 1
                                                                                        >    84          bool   reserved(bool f)  { _bf = cast(ushort) ((_bf & ~0x4000) | (f << 1
                                                                                        >    85          bool   fAckReq(bool f)   { _bf = cast(ushort) ((_bf & ~0x8000) | (f << 1
                                                                                        >    86  }
                                                                                        >    87  
                                                                                        >    88  struct DDEPOKE {
                                                                                        >    89          ushort _bf;
                                                                                        >    90          short  cfFormat;
                                                                                        >    91          byte   _Value;
                                                                                        >    92  
                                                                                        >    93          ushort unused()    { return cast(ushort) (_bf & 0x1FFF); }
                                                                                        >    94          bool   fRelease()  { return cast(bool)   (_bf & 0x2000); }
                                                                                        >    95          ubyte  fReserved() { return cast(ubyte)  ((_bf & 0xC000) >>> 14); }
                                                                                        >    96  
                                                                                        >    97          byte*  Value() { return &_Value; }
                                                                                        >    98  
                                                                                        >    99          ushort unused(ushort u) {
                                                                                        >   100                  _bf = cast(ushort) ((_bf & ~0x1FFF) | (u & 0x1FFF));
                                                                                        >   101                  return cast(ushort)(u & 0x1FFF);
                                                                                        >   102          }
                                                                                        >   103  
                                                                                        >   104          bool   fRelease(bool f)   { _bf = cast(ushort) ((_bf & ~0x2000) | (f << 
                                                                                        >   105          ubyte  fReserved(ubyte r) { _bf = cast(ushort) ((_bf & ~0xC000) | (r << 
                                                                                        >   106  }
                                                                                        >   107  
                                                                                        >   108  deprecated struct DDELN {
                                                                                        >   109          ushort _bf;
                                                                                        >   110          short  cfFormat;
                                                                                        >   111  
                                                                                        >   112          ushort unused()    { return cast(ushort) (_bf & 0x1FFF); }
                                                                                        >   113          bool   fRelease()  { return cast(bool)   (_bf & 0x2000); }
                                                                                        >   114          bool   fDeferUpd() { return cast(bool)   (_bf & 0x4000); }
                                                                                        >   115          bool   fAckReq()   { return cast(bool)   (_bf & 0x8000); }
                                                                                        >   116  
                                                                                        >   117          ushort unused(ushort u) {
                                                                                        >   118                  _bf = cast(ushort)((_bf & ~0x1FFF) | (u & 0x1FFF));
                                                                                        >   119                  return cast(ushort)(u & 0x1FFF);
                                                                                        >   120          }
                                                                                        >   121  
                                                                                        >   122          bool   fRelease(bool f)  { _bf = cast(ushort) ((_bf & ~0x2000) | (f << 1
                                                                                        >   123          bool   fDeferUpd(bool f) { _bf = cast(ushort) ((_bf & ~0x4000) | (f << 1
                                                                                        >   124          bool   fAckReq(bool f)   { _bf = cast(ushort) ((_bf & ~0x8000) | (f << 1
   43  }                                                                                    125  }
   44  alias _0 DDEACK;                                                                 <
   45                                                                                   |   126  
   46  struct _1 {                                                                      |   127  deprecated struct DDEUP {
   47  // #ifndef _MAC                                                                  <
   48  // unsigned short reserved:14,                                                   <
   49  // fDeferUpd:1,                                                                  <
   50  // fAckReq:1;                                                                    <
   51  // #else                                                                         <
   52  // ...                                                                           <
   53  // #endif                                                                        <
                                                                                        >   128          ushort _bf;
   54    short cfFormat;                                                                |   129          short  cfFormat;
                                                                                        >   130          byte   _rgb;
   55  }                                                                                |   131  
                                                                                        >   132          ushort unused()    { return cast(ushort) (_bf & 0x0FFF); }
                                                                                        >   133          bool   fAck()      { return cast(bool)   (_bf & 0x1000); }
                                                                                        >   134          bool   fRelease()  { return cast(bool)   (_bf & 0x2000); }
                                                                                        >   135          bool   fReserved() { return cast(bool)   (_bf & 0x4000); }
                                                                                        >   136          bool   fAckReq()   { return cast(bool)   (_bf & 0x8000); }
                                                                                        >   137  
   56  alias _1 DDEADVISE;                                                              |   138          byte*  rgb() { return &_rgb; }
   57                                                                                   |   139  
   58  struct _2 {                                                                      <
   59  // #ifndef _MAC                                                                  <
   60  // unsigned short unused:12,                                                     |   140          ushort unused(ushort r) {
   61  // fResponse:1,                                                                  <
   62  // fRelease:1,                                                                   <
                                                                                        >   141                  _bf = cast(ushort) ((_bf & ~0x0FFF) | (r & 0x0FFF));
                                                                                        >   142                  return cast(ushort)(r & 0x0FFF);
                                                                                        >   143          }
                                                                                        >   144  
   63  // reserved:1,                                                                   |   145          bool   fAck(bool f)      { _bf = cast(ushort) ((_bf & ~0x1000) | (f << 1
   64  // fAckReq:1;                                                                    |   146          bool   fRelease(bool f)  { _bf = cast(ushort) ((_bf & ~0x2000) | (f << 1
   65  // #else                                                                         |   147          bool   fReserved(bool f) { _bf = cast(ushort) ((_bf & ~0x4000) | (f << 1
   66  // ...                                                                           |   148          bool   fAckReq(bool f)   { _bf = cast(ushort) ((_bf & ~0x8000) | (f << 1
   67  // #endif                                                                        <
   68    short cfFormat;                                                                <
   69    BYTE Value[1];                                                                 <
   70  }                                                                                    149  }
   71  alias _2 DDEDATA;                                                                <
   72                                                                                       150  
   73  struct _3 {                                                                      |   151  extern (Windows) {
   74  // #ifndef _MAC                                                                  |   152          BOOL DdeSetQualityOfService(HWND, CPtr!(SECURITY_QUALITY_OF_SERVICE),
   75  // unsigned short unused:13,                                                     <
   76                                                                                   <
                                                                                        >   153            PSECURITY_QUALITY_OF_SERVICE);
                                                                                        >   154          BOOL ImpersonateDdeClientWindow(HWND, HWND);
   77  // fRelease:1,                                                                   |   155          LPARAM PackDDElParam(UINT, UINT_PTR, UINT_PTR);
   78  // fReserved:2;                                                                  |   156          BOOL UnpackDDElParam(UINT, LPARAM, PUINT_PTR, PUINT_PTR);
   79  // #else                                                                         |   157          BOOL FreeDDElParam(UINT, LPARAM);
   80  // ...                                                                           |   158          LPARAM ReuseDDElParam(LPARAM, UINT, UINT, UINT_PTR, UINT_PTR);
   81  // #endif                                                                        <
   82    short cfFormat;                                                                <
   83    BYTE Value[1];                                                                 <
   84                                                                                   <
   85  }                                                                                <
   86  alias _3 DDEPOKE;                                                                <
   87                                                                                   <
   88  struct _4 {                                                                      <
   89  // #ifndef _MAC                                                                  <
   90  // unsigned short unused:13,                                                     <
   91  // fRelease:1,                                                                   <
   92  // fDeferUpd:1,                                                                  <
   93  // fAckReq:1;                                                                    <
   94  // #else                                                                         <
   95  // ...                                                                           <
   96  // #endif                                                                        <
   97    short cfFormat;                                                                <
   98  }                                                                                <
   99  alias _4 DDELN;                                                                  <
  100                                                                                   <
  101  struct _5 {                                                                      <
  102  // #ifndef _MAC                                                                  <
  103  // unsigned short unused:12,                                                     <
  104  // fAck:1,                                                                       <
  105  // fRelease:1,                                                                   <
  106  // fReserved:1,                                                                  <
  107  // fAckReq:1;                                                                    <
  108  // #else                                                                         <
  109  // ...                                                                           <
  110  // #endif                                                                        <
  111    short cfFormat;                                                                <
  112    BYTE rgb[1];                                                                   <
  113  }                                                                                    159  }
  114  alias _5 DDEUP;                                                                  <
                                                                                        >   160  
                                                                                        >   161  debug (WindowsUnitTest) {
                                                                                        >   162          unittest {
                                                                                        >   163                  DDEACK ddeack;
                                                                                        >   164  
                                                                                        >   165                  with (ddeack) {
                                                                                        >   166                          reserved = 10;
                                                                                        >   167                          assert (_bf == 0x0A);
                                                                                        >   168                          fBusy = true;
                                                                                        >   169                          assert (_bf == 0x4A);
                                                                                        >   170                          fAck = true;
                                                                                        >   171                          assert (_bf == 0xCA);
                                                                                        >   172  
                                                                                        >   173                          assert (reserved == 10);
                                                                                        >   174                          assert (fBusy == true);
                                                                                        >   175                          assert (fAck == true);
                                                                                        >   176  
                                                                                        >   177                          reserved = 43;
                                                                                        >   178                          assert (_bf == 0xEB);
                                                                                        >   179                          fBusy = false;
                                                                                        >   180                          assert (_bf == 0xAB);
                                                                                        >   181                          fAck = false;
                                                                                        >   182                          assert (_bf == 0x2B);
                                                                                        >   183  
                                                                                        >   184                          assert (reserved == 43);
                                                                                        >   185                          assert (fBusy == false);
                                                                                        >   186                          assert (fAck == false);
                                                                                        >   187                  }
                                                                                        >   188  
                                                                                        >   189                  DDEPOKE ddepoke;
  115                                                                                       190  
  116  extern(Windows) export BOOL DdeSetQualityOfService(                              |   191                  with (ddepoke) {
  117      HWND hwndClient,                                                             |   192                          unused = 3456;
  118       SECURITY_QUALITY_OF_SERVICE *pqosNew,                                       |   193                          assert (_bf == 0x0D80);
  119      PSECURITY_QUALITY_OF_SERVICE pqosPrev);                                      |   194                          fRelease = true;
                                                                                        >   195                          assert (_bf == 0x2D80);
                                                                                        >   196                          fReserved = 2;
                                                                                        >   197                          assert (_bf == 0xAD80);
  120                                                                                       198  
  121  extern(Windows) export BOOL ImpersonateDdeClientWindow(                          |   199                          assert (unused == 3456);
  122      HWND hWndClient,                                                             |   200                          assert (fRelease == true);
  123      HWND hWndServer);                                                            |   201                          assert (fReserved == 2);
  124                                                                                       202  
  125  extern(Windows) export LPARAM PackDDElParam(UINT msg, UINT_PTR uiLo, UINT_PTR ui |   203                          unused = 2109;
  126  extern(Windows) export BOOL UnpackDDElParam(UINT msg, LPARAM lParam, PUINT_PTR p |   204                          assert (_bf == 0xa83d);
  127  extern(Windows) export BOOL FreeDDElParam(UINT msg, LPARAM lParam);              |   205                          fRelease = false;
  128  extern(Windows) export LPARAM ReuseDDElParam(LPARAM lParam, UINT msgIn, UINT msg |   206                          assert (_bf == 0x883d);
  129                                                                                   <
                                                                                        >   207                          fReserved = 1;
  130  // #ifdef __cplusplus                                                            |   208                          assert (_bf == 0x483d);
  131  // }                                                                             <
  132  // #endif                                                                        <
  133                                                                                       209  
  134  // #endif // _DDEHEADER_INCLUDED_                                                |   210                          assert (unused == 2109);
                                                                                        >   211                          assert (fRelease == false);
                                                                                        >   212                          assert (fReserved == 1);
                                                                                        >   213                  }
                                                                                        >   214          }
                                                                                        >   215  }