author | ptbrunet |
Mon, 03 Aug 2015 15:48:33 -0500 | |
changeset 32129 | 51464cf078d5 |
parent 29883 | e02d168adbc6 |
permissions | -rw-r--r-- |
29883
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
1 |
/* |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
2 |
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
4 |
* |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
10 |
* |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
15 |
* accompanied this code). |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
16 |
* |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
20 |
* |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
23 |
* questions. |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
24 |
*/ |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
25 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
26 |
/* |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
27 |
* A class to track key AT instance info from the JavaAccessBridge |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
28 |
*/ |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
29 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
30 |
#include "AccessBridgeDebug.h" |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
31 |
#include "AccessBridgeATInstance.h" |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
32 |
#include "AccessBridgeMessages.h" |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
33 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
34 |
#include <windows.h> |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
35 |
#include <winbase.h> |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
36 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
37 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
38 |
/** |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
39 |
* AccessBridgeATInstance constructor |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
40 |
*/ |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
41 |
AccessBridgeATInstance::AccessBridgeATInstance(HWND ourABWindow, HWND winABWindow, |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
42 |
char *memoryFilename, |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
43 |
AccessBridgeATInstance *next) { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
44 |
ourAccessBridgeWindow = ourABWindow; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
45 |
winAccessBridgeWindow = winABWindow; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
46 |
nextATInstance = next; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
47 |
javaEventMask = 0; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
48 |
accessibilityEventMask = 0; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
49 |
strncpy(memoryMappedFileName, memoryFilename, cMemoryMappedNameSize); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
50 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
51 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
52 |
/** |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
53 |
* AccessBridgeATInstance descructor |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
54 |
*/ |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
55 |
AccessBridgeATInstance::~AccessBridgeATInstance() { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
56 |
PrintDebugString("\r\nin AccessBridgeATInstance::~AccessBridgeATInstance"); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
57 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
58 |
// if IPC memory mapped file view is valid, unmap it |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
59 |
if (memoryMappedView != (char *) 0) { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
60 |
PrintDebugString(" unmapping memoryMappedView; view = %p", memoryMappedView); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
61 |
UnmapViewOfFile(memoryMappedView); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
62 |
memoryMappedView = (char *) 0; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
63 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
64 |
// if IPC memory mapped file handle map is open, close it |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
65 |
if (memoryMappedFileMapHandle != (HANDLE) 0) { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
66 |
PrintDebugString(" closing memoryMappedFileMapHandle; handle = %p", memoryMappedFileMapHandle); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
67 |
CloseHandle(memoryMappedFileMapHandle); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
68 |
memoryMappedFileMapHandle = (HANDLE) 0; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
69 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
70 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
71 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
72 |
/** |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
73 |
* Sets up the memory-mapped file to do IPC messaging |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
74 |
* 1 files is created: to handle requests for information |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
75 |
* initiated from Windows AT. The package is placed into |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
76 |
* the memory-mapped file (char *memoryMappedView), |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
77 |
* and then a special SendMessage() is sent. When the |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
78 |
* JavaDLL returns from SendMessage() processing, the |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
79 |
* data will be in memoryMappedView. The SendMessage() |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
80 |
* return value tells us if all is right with the world. |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
81 |
* |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
82 |
* The set-up proces involves creating the memory-mapped |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
83 |
* file, and writing a special string to it so that the |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
84 |
* WindowsDLL so it knows about it as well. |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
85 |
*/ |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
86 |
LRESULT |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
87 |
AccessBridgeATInstance::initiateIPC() { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
88 |
DWORD errorCode; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
89 |
|
32129 | 90 |
PrintDebugString("\r\nIn AccessBridgeATInstance::initiateIPC()"); |
29883
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
91 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
92 |
// open Windows-initiated IPC filemap & map it to a ptr |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
93 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
94 |
memoryMappedFileMapHandle = OpenFileMapping(FILE_MAP_READ | FILE_MAP_WRITE, |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
95 |
FALSE, memoryMappedFileName); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
96 |
if (memoryMappedFileMapHandle == NULL) { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
97 |
errorCode = GetLastError(); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
98 |
PrintDebugString(" Failed to CreateFileMapping for %s, error: %X", memoryMappedFileName, errorCode); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
99 |
return errorCode; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
100 |
} else { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
101 |
PrintDebugString(" CreateFileMapping worked - filename: %s", memoryMappedFileName); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
102 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
103 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
104 |
memoryMappedView = (char *) MapViewOfFile(memoryMappedFileMapHandle, |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
105 |
FILE_MAP_READ | FILE_MAP_WRITE, |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
106 |
0, 0, 0); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
107 |
if (memoryMappedView == NULL) { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
108 |
errorCode = GetLastError(); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
109 |
PrintDebugString(" Failed to MapViewOfFile for %s, error: %X", memoryMappedFileName, errorCode); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
110 |
return errorCode; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
111 |
} else { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
112 |
PrintDebugString(" MapViewOfFile worked - view: %p", memoryMappedView); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
113 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
114 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
115 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
116 |
// look for the JavaDLL's answer to see if it could read the file |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
117 |
if (strcmp(memoryMappedView, AB_MEMORY_MAPPED_FILE_OK_QUERY) != 0) { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
118 |
PrintDebugString(" JavaVM failed to write to memory mapped file %s", |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
119 |
memoryMappedFileName); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
120 |
return -1; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
121 |
} else { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
122 |
PrintDebugString(" JavaVM successfully wrote to file!"); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
123 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
124 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
125 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
126 |
// write some data to the memory mapped file for WindowsDLL to verify |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
127 |
strcpy(memoryMappedView, AB_MEMORY_MAPPED_FILE_OK_ANSWER); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
128 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
129 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
130 |
return 0; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
131 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
132 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
133 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
134 |
typedef struct EVENT_STRUCT |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
135 |
{ |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
136 |
char *buffer; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
137 |
int bufsize; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
138 |
ABHWND64 winAccessBridgeWindow; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
139 |
ABHWND64 ourAccessBridgeWindow; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
140 |
}EVENT_STRUCT; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
141 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
142 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
143 |
#include <process.h> |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
144 |
#define THREAD_PROC unsigned int __stdcall |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
145 |
typedef unsigned int (__stdcall *THREAD_ROUTINE)(LPVOID lpThreadParameter); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
146 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
147 |
static HANDLE BeginThread(THREAD_ROUTINE thread_func,DWORD *id,DWORD param) |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
148 |
{ |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
149 |
HANDLE ret; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
150 |
ret = (HANDLE) _beginthreadex(NULL,0,thread_func,(void *)param,0,(unsigned int *)id); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
151 |
if(ret == INVALID_HANDLE_VALUE) |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
152 |
ret = NULL; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
153 |
return(ret); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
154 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
155 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
156 |
DWORD JavaBridgeThreadId = 0; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
157 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
158 |
static THREAD_PROC JavaBridgeThread(LPVOID param1) |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
159 |
{ |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
160 |
MSG msg; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
161 |
DWORD rc = 0; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
162 |
while (GetMessage(&msg, // message structure |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
163 |
NULL, // handle of window receiving the message |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
164 |
0, // lowest message to examine |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
165 |
0)) // highest message to examine |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
166 |
{ |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
167 |
if(msg.message == WM_USER) |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
168 |
{ |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
169 |
EVENT_STRUCT *event_struct = (EVENT_STRUCT *)msg.wParam; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
170 |
COPYDATASTRUCT toCopy; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
171 |
toCopy.dwData = 0; // 32-bits we could use for something... |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
172 |
toCopy.cbData = event_struct->bufsize; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
173 |
toCopy.lpData = event_struct->buffer; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
174 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
175 |
LRESULT ret = SendMessage((HWND)ABLongToHandle(event_struct->winAccessBridgeWindow), WM_COPYDATA, |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
176 |
(WPARAM)event_struct->ourAccessBridgeWindow, (LPARAM) &toCopy); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
177 |
delete event_struct->buffer; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
178 |
delete event_struct; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
179 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
180 |
if(msg.message == (WM_USER+1)) |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
181 |
PostQuitMessage(0); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
182 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
183 |
JavaBridgeThreadId = 0; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
184 |
return(0); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
185 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
186 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
187 |
/* |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
188 |
* Handles one event |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
189 |
*/ |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
190 |
static void do_event(char *buffer, int bufsize,HWND ourAccessBridgeWindow,HWND winAccessBridgeWindow) |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
191 |
{ |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
192 |
EVENT_STRUCT *event_struct = new EVENT_STRUCT; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
193 |
event_struct->bufsize = bufsize; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
194 |
event_struct->buffer = new char[bufsize]; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
195 |
memcpy(event_struct->buffer,buffer,bufsize); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
196 |
event_struct->ourAccessBridgeWindow = ABHandleToLong(ourAccessBridgeWindow); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
197 |
event_struct->winAccessBridgeWindow = ABHandleToLong(winAccessBridgeWindow); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
198 |
if(!JavaBridgeThreadId) |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
199 |
{ |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
200 |
HANDLE JavaBridgeThreadHandle = BeginThread(JavaBridgeThread,&JavaBridgeThreadId,(DWORD)event_struct); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
201 |
CloseHandle(JavaBridgeThreadHandle); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
202 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
203 |
PostThreadMessage(JavaBridgeThreadId,WM_USER,(WPARAM)event_struct,0); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
204 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
205 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
206 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
207 |
/** |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
208 |
* sendJavaEventPackage - uses SendMessage(WM_COPYDATA) to do |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
209 |
* IPC messaging with the Java AccessBridge DLL |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
210 |
* to propogate events to those ATs that want 'em |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
211 |
* |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
212 |
*/ |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
213 |
LRESULT |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
214 |
AccessBridgeATInstance::sendJavaEventPackage(char *buffer, int bufsize, long eventID) { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
215 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
216 |
PrintDebugString("AccessBridgeATInstance::sendJavaEventPackage() eventID = %X", eventID); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
217 |
PrintDebugString("AccessBridgeATInstance::sendJavaEventPackage() (using PostMessage) eventID = %X", eventID); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
218 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
219 |
if (eventID & javaEventMask) { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
220 |
do_event(buffer,bufsize,ourAccessBridgeWindow,winAccessBridgeWindow); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
221 |
return(0); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
222 |
} else { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
223 |
return -1; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
224 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
225 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
226 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
227 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
228 |
/** |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
229 |
* uses SendMessage(WM_COPYDATA) to do |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
230 |
* IPC messaging with the Java AccessBridge DLL |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
231 |
* to propogate events to those ATs that want 'em |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
232 |
* |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
233 |
*/ |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
234 |
LRESULT |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
235 |
AccessBridgeATInstance::sendAccessibilityEventPackage(char *buffer, int bufsize, long eventID) { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
236 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
237 |
PrintDebugString("AccessBridgeATInstance::sendAccessibilityEventPackage() eventID = %X", eventID); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
238 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
239 |
if (eventID & accessibilityEventMask) { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
240 |
do_event(buffer,bufsize,ourAccessBridgeWindow,winAccessBridgeWindow); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
241 |
return(0); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
242 |
} else { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
243 |
return -1; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
244 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
245 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
246 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
247 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
248 |
/** |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
249 |
* findABATInstanceFromATHWND - walk through linked list from |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
250 |
* where we are. Return the |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
251 |
* AccessBridgeATInstance |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
252 |
* of the ABATInstance that |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
253 |
* matches the passed in vmID; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
254 |
* no match: return 0 |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
255 |
*/ |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
256 |
AccessBridgeATInstance * |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
257 |
AccessBridgeATInstance::findABATInstanceFromATHWND(HWND window) { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
258 |
// no need to recurse really |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
259 |
if (winAccessBridgeWindow == window) { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
260 |
return this; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
261 |
} else { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
262 |
AccessBridgeATInstance *current = nextATInstance; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
263 |
while (current != (AccessBridgeATInstance *) 0) { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
264 |
if (current->winAccessBridgeWindow == window) { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
265 |
return current; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
266 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
267 |
current = current->nextATInstance; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
268 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
269 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
270 |
return (AccessBridgeATInstance *) 0; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
271 |
} |