]> cygwin.com Git - cygwin-apps/setup.git/blobdiff - win32.h
Use solver to check for problems and produce a list of package transactions
[cygwin-apps/setup.git] / win32.h
diff --git a/win32.h b/win32.h
index 92146426501eb1fd3929717412796be4b4226417..c866790df6d8a1046ebb702852309d82a33b5959 100644 (file)
--- a/win32.h
+++ b/win32.h
 #include <sys/types.h>
 #include <string>
 
+/* Needed for some buffers etc., to have a useful replacement for MAX_PATH. */
+#define CYG_PATH_MAX   4096
+
 /* Any include of <windows.h> should be through this file, which wraps it in
  * various other handling. */
 
 /* Basic Windows features only. */
 #define WIN32_LEAN_AND_MEAN
 
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0a00
+
 /* libstdc++-v3 _really_ dislikes min & max defined as macros. */
 /* As of gcc 3.3.1, it defines NOMINMAX itself, so test first,
  * to avoid a redefinition error */
 /* # of 100ns intervals per second. */
 #define NSPERSEC 10000000LL
 
-/* In w32api 3.1, __declspec(dllimport) decoration is added to
- * certain symbols. This breaks our autoload mechanism - the symptom is
- * multiple declaration errors at link time. This define turns that off again.
- * It will default to off again in later w32api versions, but we need to work
- * with 3.1 for now. */
-#define DECLSPEC_IMPORT
+/* Defining WINBASEAPI is required due the overloading definitions of some
+   kernel32 functions in filemanip.cc. */
 #define WINBASEAPI
 
-/* Require at least Internet Explorer 3, in order to have access to
- * sufficient Windows Common Controls features from <commctrl.h> . */
-#define _WIN32_IE 0x0300
-
 #include <windows.h>
 
 /* FIXME: The use of _access(fname, 0) as an existence check should be
@@ -66,7 +64,7 @@
        ((__c) == '/' || (__c) == '\\'); \
     })
 
-/* Maximum size of a SID on NT/W2K. */
+/* Maximum size of a SID. */
 #define MAX_SID_LEN    40
 
 /* Computes the size of an ACL in relation to the number of ACEs it
@@ -75,8 +73,9 @@
                             (cnt) * (sizeof (ACCESS_ALLOWED_ACE) + MAX_SID_LEN))
 
 struct acl_t {
- ACL acl;
- char aclbuf[TOKEN_ACL_SIZE (7)];
+  /* Make sure &acl is 4-byte aligned. */
+  ACL acl __attribute__ ((aligned (4)));
+  char aclbuf[TOKEN_ACL_SIZE (7)];
 };
 
 class SIDWrapper {
@@ -130,12 +129,13 @@ public:
                                      SECURITY_DESCRIPTOR &out_sd, acl_t &acl);
   void resetPrimaryGroup();
   void setAdminGroup ();
+  void initialiseWellKnownSIDs ();
   void setDefaultSecurity();
+  bool isRunAsAdmin ();
 private:
   void NoteFailedAPI (const std::string &);
   bool wellKnownSIDsinitialized () const { return _wellKnownSIDsinitialized; }
   void wellKnownSIDsinitialized (bool b) { _wellKnownSIDsinitialized = b; }
-  void initialiseWellKnownSIDs ();
   void setDefaultDACL ();
   void setBackupPrivileges ();
 
@@ -166,6 +166,7 @@ class VersionInfo
      VersionInfo ();
      DWORD major () const { return v.dwMajorVersion; }
      DWORD minor () const { return v.dwMinorVersion; }
+     DWORD buildNumber () const { return v.dwBuildNumber; }
   private:
      OSVERSIONINFO v;
 };
@@ -174,5 +175,20 @@ VersionInfo& GetVer ();
 
 #define OSMajorVersion() (GetVer ().major ())
 #define OSMinorVersion() (GetVer ().minor ())
+#define OSBuildNumber() (GetVer ().buildNumber ())
+
+static inline void
+GetDlgItemRect (HWND h, int item, LPRECT r)
+{
+  GetWindowRect (GetDlgItem (h, item), r);
+  MapWindowPoints (HWND_DESKTOP, h, (LPPOINT) r, 2);
+}
+
+static inline void
+SetDlgItemRect (HWND h, int item, LPRECT r)
+{
+  MoveWindow (GetDlgItem (h, item), r->left, r->top,
+             r->right - r->left, r->bottom - r->top, TRUE);
+}
 
 #endif /* SETUP_WIN32_H */
This page took 0.022969 seconds and 5 git commands to generate.