< prev index next >

src/jdk.incubator.jpackage/windows/native/libjpackage/UniqueHandle.h

Print this page

        

@@ -21,14 +21,23 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
+#ifndef UNIQUEHANDLE_H
+#define UNIQUEHANDLE_H
+
 #include <windows.h>
+#include <memory>
+
 
-extern "C" {
+struct WndHandleDeleter {
+    typedef HANDLE pointer;
 
-    BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
-            LPVOID lpvReserved) {
-        return true;
+    void operator()(HANDLE h) {
+        ::CloseHandle(h);
     }
-}
\ No newline at end of file
+};
+
+typedef std::unique_ptr<HANDLE, WndHandleDeleter> UniqueHandle;
+
+#endif // #ifndef UNIQUEHANDLE_H
< prev index next >