< prev index next >

src/jdk.jpackage/windows/native/libapplauncher/WindowsPlatform.h

Print this page




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #include "Platform.h"
  27 
  28 #ifdef WINDOWS
  29 
  30 #ifndef WINDOWSPLATFORM_H
  31 #define WINDOWSPLATFORM_H
  32 
  33 #include "GenericPlatform.h"
  34 
  35 #include <Windows.h>

  36 
  37 #pragma warning( push )
  38 // C4250 - 'class1' : inherits 'class2::member'
  39 #pragma warning( disable : 4250 )
  40 class WindowsPlatform : virtual public Platform, GenericPlatform {
  41 private:
  42     DWORD FMainThread;
  43 
  44 public:
  45     WindowsPlatform(void);
  46     virtual ~WindowsPlatform(void);
  47 
  48     virtual TCHAR* ConvertStringToFileSystemString(TCHAR* Source,
  49             bool &release);
  50     virtual TCHAR* ConvertFileSystemStringToString(TCHAR* Source,
  51             bool &release);
  52 
  53     virtual void ShowMessage(TString title, TString description);
  54     virtual void ShowMessage(TString description);
  55     virtual MessageResponse ShowResponseMessage(TString title,
  56             TString description);
  57     //virtual MessageResponse ShowResponseMessage(TString description);
  58 
  59     virtual void SetCurrentDirectory(TString Value);
  60     virtual TString GetPackageRootDirectory();
  61     virtual TString GetAppDataDirectory();

  62     virtual TString GetBundledJVMLibraryFileName(TString RuntimePath);



  63 
  64     virtual ISectionalPropertyContainer* GetConfigFile(TString FileName);
  65 
  66     virtual TString GetModuleFileName();
  67     virtual Module LoadLibrary(TString FileName);
  68     virtual void FreeLibrary(Module AModule);
  69     virtual Procedure GetProcAddress(Module AModule, std::string MethodName);
  70     virtual std::vector<TString> GetLibraryImports(const TString FileName);
  71     virtual std::vector<TString> FilterOutRuntimeDependenciesForPlatform(
  72             std::vector<TString> Imports);
  73 
  74     virtual Process* CreateProcess();
  75 
  76     virtual bool IsMainThread();
  77     virtual TPlatformNumber GetMemorySize();
  78 
  79     virtual TString GetTempDirectory();
  80 
  81 #ifdef DEBUG
  82     virtual bool IsNativeDebuggerPresent();
  83     virtual int GetProcessID();
  84 #endif //DEBUG
  85 };
  86 #pragma warning( pop ) // C4250
  87 
  88 
  89 class FileHandle {
  90 private:
  91     HANDLE FHandle;
  92 
  93 public:
  94     FileHandle(std::wstring FileName);
  95     ~FileHandle();
  96 
  97     bool IsValid();
  98     HANDLE GetHandle();
  99 };
 100 
 101 
 102 class FileMappingHandle {
 103 private:
 104     HANDLE FHandle;
 105 
 106 public:
 107     FileMappingHandle(HANDLE FileHandle);


 165     PROCESS_INFORMATION FProcessInfo;
 166     static WindowsJob FJob;
 167 
 168     void Cleanup();
 169     bool ReadOutput();
 170 
 171 public:
 172     WindowsProcess();
 173     virtual ~WindowsProcess();
 174 
 175     virtual bool IsRunning();
 176     virtual bool Terminate();
 177     virtual bool Execute(const TString Application,
 178             const std::vector<TString> Arguments, bool AWait = false);
 179     virtual bool Wait();
 180     virtual TProcessID GetProcessID();
 181     virtual void SetInput(TString Value);
 182     virtual std::list<TString> GetOutput();
 183 };
 184 
 185 
 186 
 187 
 188 #endif // WINDOWSPLATFORM_H
 189 
 190 #endif // WINDOWS


   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 




  26 #ifndef WINDOWSPLATFORM_H
  27 #define WINDOWSPLATFORM_H
  28 


  29 #include <Windows.h>
  30 #include "Platform.h"
  31 
  32 class WindowsPlatform : virtual public Platform {



  33 private:
  34     DWORD FMainThread;
  35 
  36 public:
  37     WindowsPlatform(void);
  38     virtual ~WindowsPlatform(void);
  39 
  40     virtual TCHAR* ConvertStringToFileSystemString(TCHAR* Source,
  41             bool &release);
  42     virtual TCHAR* ConvertFileSystemStringToString(TCHAR* Source,
  43             bool &release);
  44 
  45     virtual void ShowMessage(TString title, TString description);
  46     virtual void ShowMessage(TString description);
  47     virtual MessageResponse ShowResponseMessage(TString title,
  48             TString description);

  49 
  50     virtual void SetCurrentDirectory(TString Value);
  51     virtual TString GetPackageRootDirectory();
  52     virtual TString GetAppDataDirectory();
  53     virtual TString GetAppName();
  54     virtual TString GetBundledJVMLibraryFileName(TString RuntimePath);
  55     TString GetPackageAppDirectory();
  56     TString GetPackageLauncherDirectory();
  57     TString GetPackageRuntimeBinDirectory();
  58 
  59     virtual ISectionalPropertyContainer* GetConfigFile(TString FileName);
  60 
  61     virtual TString GetModuleFileName();
  62     virtual Module LoadLibrary(TString FileName);
  63     virtual void FreeLibrary(Module AModule);
  64     virtual Procedure GetProcAddress(Module AModule, std::string MethodName);



  65 
  66     virtual Process* CreateProcess();
  67 
  68     virtual bool IsMainThread();
  69     virtual TPlatformNumber GetMemorySize();
  70 
  71     virtual TString GetTempDirectory();
  72     void InitStreamLocale(wios *stream);
  73     void addPlatformDependencies(JavaLibrary *pJavaLibrary);



  74 };


  75 
  76 class FileHandle {
  77 private:
  78     HANDLE FHandle;
  79 
  80 public:
  81     FileHandle(std::wstring FileName);
  82     ~FileHandle();
  83 
  84     bool IsValid();
  85     HANDLE GetHandle();
  86 };
  87 
  88 
  89 class FileMappingHandle {
  90 private:
  91     HANDLE FHandle;
  92 
  93 public:
  94     FileMappingHandle(HANDLE FileHandle);


 152     PROCESS_INFORMATION FProcessInfo;
 153     static WindowsJob FJob;
 154 
 155     void Cleanup();
 156     bool ReadOutput();
 157 
 158 public:
 159     WindowsProcess();
 160     virtual ~WindowsProcess();
 161 
 162     virtual bool IsRunning();
 163     virtual bool Terminate();
 164     virtual bool Execute(const TString Application,
 165             const std::vector<TString> Arguments, bool AWait = false);
 166     virtual bool Wait();
 167     virtual TProcessID GetProcessID();
 168     virtual void SetInput(TString Value);
 169     virtual std::list<TString> GetOutput();
 170 };
 171 



 172 #endif // WINDOWSPLATFORM_H


< prev index next >