summaryrefslogtreecommitdiff
path: root/packaging/0029-Allocate-FileMappingImmutableData-szFileName-and-CFi.patch
blob: 0d51058234f0bd0cbc3f3f6ebd9af586be710198 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
From ed41e9b578a7e888031896562ac0ce5657dc58f7 Mon Sep 17 00:00:00 2001
From: gbalykov <g.balykov@samsung.com>
Date: Tue, 15 Aug 2017 19:15:47 +0300
Subject: [PATCH 29/32] Allocate FileMappingImmutableData::szFileName and
 CFileProcessLocalData::unix_filename strings dynamically (#13374)

---
 src/pal/inc/pal.h                       |  13 --
 src/pal/src/cruntime/filecrt.cpp        |   2 +-
 src/pal/src/file/file.cpp               |  45 ++++-
 src/pal/src/include/pal/corunix.hpp     |  60 +++++-
 src/pal/src/include/pal/event.hpp       |   9 -
 src/pal/src/include/pal/file.hpp        |   2 +-
 src/pal/src/include/pal/map.hpp         |  11 +-
 src/pal/src/include/pal/semaphore.hpp   |   9 -
 src/pal/src/map/map.cpp                 | 122 ++++++------
 src/pal/src/objmgr/palobjbase.cpp       |  10 +
 src/pal/src/objmgr/shmobject.cpp        | 294 ++--------------------------
 src/pal/src/objmgr/shmobject.hpp        |  21 +-
 src/pal/src/objmgr/shmobjectmanager.cpp | 337 +-------------------------------
 src/pal/src/objmgr/shmobjectmanager.hpp |   7 -
 src/pal/src/synchobj/event.cpp          |  88 +--------
 src/pal/src/synchobj/mutex.cpp          |   6 +
 src/pal/src/synchobj/semaphore.cpp      |  85 +-------
 src/pal/src/thread/process.cpp          |  11 +-
 src/pal/src/thread/thread.cpp           |   9 +-
 19 files changed, 231 insertions(+), 910 deletions(-)

diff --git a/src/pal/inc/pal.h b/src/pal/inc/pal.h
index 0f470d9..0a00b67 100644
--- a/src/pal/inc/pal.h
+++ b/src/pal/inc/pal.h
@@ -1601,19 +1601,6 @@ WaitForMultipleObjectsEx(
              IN DWORD dwMilliseconds,
              IN BOOL bAlertable);
 
-PALIMPORT
-RHANDLE
-PALAPI
-PAL_LocalHandleToRemote(
-            IN HANDLE hLocal);
-
-PALIMPORT
-HANDLE
-PALAPI
-PAL_RemoteHandleToLocal(
-            IN RHANDLE hRemote);
-
-
 #define DUPLICATE_CLOSE_SOURCE      0x00000001
 #define DUPLICATE_SAME_ACCESS       0x00000002
 
diff --git a/src/pal/src/cruntime/filecrt.cpp b/src/pal/src/cruntime/filecrt.cpp
index 48079b3..182a42d 100644
--- a/src/pal/src/cruntime/filecrt.cpp
+++ b/src/pal/src/cruntime/filecrt.cpp
@@ -93,7 +93,7 @@ _open_osfhandle( INT_PTR osfhandle, int flags )
 
     if (NO_ERROR == palError)
     {
-        if ('\0' != pLocalData->unix_filename[0])
+        if (NULL != pLocalData->unix_filename)
         {
             nRetVal = InternalOpen(pLocalData->unix_filename, openFlags);
         }
diff --git a/src/pal/src/file/file.cpp b/src/pal/src/file/file.cpp
index feec655..e7003c0 100644
--- a/src/pal/src/file/file.cpp
+++ b/src/pal/src/file/file.cpp
@@ -56,6 +56,12 @@ InternalSetFilePointerForUnixFd(
     );
 
 void
+CFileProcessLocalDataCleanupRoutine(
+    CPalThread *pThread,
+    IPalObject *pObjectToCleanup
+    );
+
+void
 FileCleanupRoutine(
     CPalThread *pThread,
     IPalObject *pObjectToCleanup,
@@ -68,7 +74,10 @@ CObjectType CorUnix::otFile(
                 FileCleanupRoutine,
                 NULL,   // No initialization routine
                 0,      // No immutable data
+                NULL,   // No immutable data copy routine
+                NULL,   // No immutable data cleanup routine
                 sizeof(CFileProcessLocalData),
+                CFileProcessLocalDataCleanupRoutine,
                 0,      // No shared data
                 GENERIC_READ|GENERIC_WRITE,  // Ignored -- no Win32 object security support
                 CObjectType::SecuritySupported,
@@ -86,6 +95,34 @@ static CSharedMemoryFileLockMgr _FileLockManager;
 IFileLockManager *CorUnix::g_pFileLockManager = &_FileLockManager;
 
 void
+CFileProcessLocalDataCleanupRoutine(
+    CPalThread *pThread,
+    IPalObject *pObjectToCleanup
+    )
+{
+    PAL_ERROR palError;
+    CFileProcessLocalData *pLocalData = NULL;
+    IDataLock *pLocalDataLock = NULL;
+
+    palError = pObjectToCleanup->GetProcessLocalData(
+        pThread,
+        ReadLock,
+        &pLocalDataLock,
+        reinterpret_cast<void**>(&pLocalData)
+        );
+
+    if (NO_ERROR != palError)
+    {
+        ASSERT("Unable to obtain data to cleanup file object");
+        return;
+    }
+
+    free(pLocalData->unix_filename);
+
+    pLocalDataLock->ReleaseLock(pThread, FALSE);
+}
+
+void
 FileCleanupRoutine(
     CPalThread *pThread,
     IPalObject *pObjectToCleanup,
@@ -738,10 +775,12 @@ CorUnix::InternalCreateFile(
         goto done;
     }
 
-    if (strcpy_s(pLocalData->unix_filename, sizeof(pLocalData->unix_filename), lpUnixPath) != SAFECRT_SUCCESS)
+    _ASSERTE(pLocalData->unix_filename == NULL);
+    pLocalData->unix_filename = strdup(lpUnixPath);
+    if (pLocalData->unix_filename == NULL)
     {
-        palError = ERROR_INSUFFICIENT_BUFFER;
-        TRACE("strcpy_s failed!\n");
+        ASSERT("Unable to copy string\n");
+        palError = ERROR_INTERNAL_ERROR;
         goto done;
     }
 
diff --git a/src/pal/src/include/pal/corunix.hpp b/src/pal/src/include/pal/corunix.hpp
index e9e9503..bfdfb6c 100644
--- a/src/pal/src/include/pal/corunix.hpp
+++ b/src/pal/src/include/pal/corunix.hpp
@@ -173,6 +173,15 @@ namespace CorUnix
         void *          // pProcessLocalData
         );
 
+    typedef void (*OBJECT_IMMUTABLE_DATA_COPY_ROUTINE) (
+        void *,
+        void *);
+    typedef void (*OBJECT_IMMUTABLE_DATA_CLEANUP_ROUTINE) (
+        void *);
+    typedef void (*OBJECT_PROCESS_LOCAL_DATA_CLEANUP_ROUTINE) (
+        CPalThread *,   // pThread
+        IPalObject *);
+
     enum PalObjectTypeId
     {
         otiAutoResetEvent = 0,
@@ -315,7 +324,10 @@ namespace CorUnix
         OBJECTCLEANUPROUTINE m_pCleanupRoutine;
         OBJECTINITROUTINE m_pInitRoutine;
         DWORD m_dwImmutableDataSize;
+        OBJECT_IMMUTABLE_DATA_COPY_ROUTINE m_pImmutableDataCopyRoutine;
+        OBJECT_IMMUTABLE_DATA_CLEANUP_ROUTINE m_pImmutableDataCleanupRoutine;
         DWORD m_dwProcessLocalDataSize;
+        OBJECT_PROCESS_LOCAL_DATA_CLEANUP_ROUTINE m_pProcessLocalDataCleanupRoutine;
         DWORD m_dwSharedDataSize;
         DWORD m_dwSupportedAccessRights;
         // Generic access rights mapping
@@ -335,7 +347,10 @@ namespace CorUnix
             OBJECTCLEANUPROUTINE pCleanupRoutine,
             OBJECTINITROUTINE pInitRoutine,
             DWORD dwImmutableDataSize,
+            OBJECT_IMMUTABLE_DATA_COPY_ROUTINE pImmutableDataCopyRoutine,
+            OBJECT_IMMUTABLE_DATA_CLEANUP_ROUTINE pImmutableDataCleanupRoutine,
             DWORD dwProcessLocalDataSize,
+            OBJECT_PROCESS_LOCAL_DATA_CLEANUP_ROUTINE pProcessLocalDataCleanupRoutine,
             DWORD dwSharedDataSize,
             DWORD dwSupportedAccessRights,
             SecuritySupport eSecuritySupport,
@@ -352,7 +367,10 @@ namespace CorUnix
             m_pCleanupRoutine(pCleanupRoutine),
             m_pInitRoutine(pInitRoutine),
             m_dwImmutableDataSize(dwImmutableDataSize),
+            m_pImmutableDataCopyRoutine(pImmutableDataCopyRoutine),
+            m_pImmutableDataCleanupRoutine(pImmutableDataCleanupRoutine),
             m_dwProcessLocalDataSize(dwProcessLocalDataSize),
+            m_pProcessLocalDataCleanupRoutine(pProcessLocalDataCleanupRoutine),
             m_dwSharedDataSize(dwSharedDataSize),
             m_dwSupportedAccessRights(dwSupportedAccessRights),
             m_eSecuritySupport(eSecuritySupport),
@@ -408,6 +426,38 @@ namespace CorUnix
             return  m_dwImmutableDataSize;
         };
         
+        void
+        SetImmutableDataCopyRoutine(
+            OBJECT_IMMUTABLE_DATA_COPY_ROUTINE ptr
+            )
+        {
+            m_pImmutableDataCopyRoutine = ptr;
+        };
+
+        OBJECT_IMMUTABLE_DATA_COPY_ROUTINE
+        GetImmutableDataCopyRoutine(
+            void
+            )
+        {
+            return m_pImmutableDataCopyRoutine;
+        };
+
+        void
+        SetImmutableDataCleanupRoutine(
+            OBJECT_IMMUTABLE_DATA_CLEANUP_ROUTINE ptr
+            )
+        {
+            m_pImmutableDataCleanupRoutine = ptr;
+        };
+
+        OBJECT_IMMUTABLE_DATA_CLEANUP_ROUTINE
+        GetImmutableDataCleanupRoutine(
+            void
+            )
+        {
+            return m_pImmutableDataCleanupRoutine;
+        }
+
         DWORD
         GetProcessLocalDataSize(
             void
@@ -415,7 +465,15 @@ namespace CorUnix
         {
             return m_dwProcessLocalDataSize;
         };
-        
+
+        OBJECT_PROCESS_LOCAL_DATA_CLEANUP_ROUTINE
+        GetProcessLocalDataCleanupRoutine(
+            void
+            )
+        {
+            return m_pProcessLocalDataCleanupRoutine;
+        }
+
         DWORD
         GetSharedDataSize(
             void
diff --git a/src/pal/src/include/pal/event.hpp b/src/pal/src/include/pal/event.hpp
index 98eeaee..21dc478 100644
--- a/src/pal/src/include/pal/event.hpp
+++ b/src/pal/src/include/pal/event.hpp
@@ -44,15 +44,6 @@ namespace CorUnix
         HANDLE hEvent,
         BOOL fSetEvent
         );
-
-    PAL_ERROR
-    InternalOpenEvent(
-        CPalThread *pThread,
-        DWORD dwDesiredAccess,
-        BOOL bInheritHandle,
-        LPCWSTR lpName,
-        HANDLE *phEvent
-        );
         
 }
 
diff --git a/src/pal/src/include/pal/file.hpp b/src/pal/src/include/pal/file.hpp
index 5acccb0..22e4187 100644
--- a/src/pal/src/include/pal/file.hpp
+++ b/src/pal/src/include/pal/file.hpp
@@ -44,7 +44,7 @@ namespace CorUnix
                                   In Windows we can open a file for writing only */
         int  open_flags;       /* stores Unix file creation flags */
         BOOL open_flags_deviceaccessonly;
-        char unix_filename[MAXPATHLEN];
+        CHAR *unix_filename;
         BOOL inheritable;
     };
 
diff --git a/src/pal/src/include/pal/map.hpp b/src/pal/src/include/pal/map.hpp
index 854e6c5..7bcb20a 100644
--- a/src/pal/src/include/pal/map.hpp
+++ b/src/pal/src/include/pal/map.hpp
@@ -144,7 +144,7 @@ namespace CorUnix
     class CFileMappingImmutableData
     {
     public:
-        CHAR szFileName[MAXPATHLEN];
+        CHAR *lpFileName;
         UINT MaxSize;               // The max size of the file mapping object
         DWORD flProtect;            // Protection desired for the file view
         BOOL bPALCreatedTempFile;   // TRUE if it's a PAL created file
@@ -179,15 +179,6 @@ namespace CorUnix
         );
 
     PAL_ERROR
-    InternalOpenFileMapping(
-        CPalThread *pThread,
-        DWORD dwDesiredAccess,
-        BOOL bInheritHandle,
-        LPCWSTR lpName,
-        HANDLE *phMapping
-        );
-
-    PAL_ERROR
     InternalMapViewOfFile(
         CPalThread *pThread,
         HANDLE hFileMappingObject,
diff --git a/src/pal/src/include/pal/semaphore.hpp b/src/pal/src/include/pal/semaphore.hpp
index 2943d61..33cf35b 100644
--- a/src/pal/src/include/pal/semaphore.hpp
+++ b/src/pal/src/include/pal/semaphore.hpp
@@ -49,15 +49,6 @@ namespace CorUnix
         LONG lReleaseCount,
         LPLONG lpPreviousCount
         );
-
-    PAL_ERROR
-    InternalOpenSemaphore(
-        CPalThread *pThread,
-        DWORD dwDesiredAccess,
-        BOOL bInheritHandle,
-        LPCWSTR lpName,
-        HANDLE *phSemaphore
-        );
         
 }
 
diff --git a/src/pal/src/map/map.cpp b/src/pal/src/map/map.cpp
index b8ffc84..f99e330 100644
--- a/src/pal/src/map/map.cpp
+++ b/src/pal/src/map/map.cpp
@@ -131,12 +131,26 @@ FileMappingInitializationRoutine(
     void *pProcessLocalData
     );
 
+void
+CFileMappingImmutableDataCopyRoutine(
+    void *pImmData,
+    void *pImmDataTarget
+    );
+
+void
+CFileMappingImmutableDataCleanupRoutine(
+    void *pImmData
+    );
+
 CObjectType CorUnix::otFileMapping(
                 otiFileMapping,
                 FileMappingCleanupRoutine,
                 FileMappingInitializationRoutine,
                 sizeof(CFileMappingImmutableData),
+                CFileMappingImmutableDataCopyRoutine,
+                CFileMappingImmutableDataCleanupRoutine,
                 sizeof(CFileMappingProcessLocalData),
+                NULL,   // No process local data cleanup routine
                 0,
                 PAGE_READWRITE | PAGE_READONLY | PAGE_WRITECOPY,
                 CObjectType::SecuritySupported,
@@ -152,6 +166,33 @@ CObjectType CorUnix::otFileMapping(
 CAllowedObjectTypes aotFileMapping(otiFileMapping);
 
 void
+CFileMappingImmutableDataCopyRoutine(
+    void *pImmData,
+    void *pImmDataTarget
+    )
+{
+    PAL_ERROR palError = NO_ERROR;
+    CFileMappingImmutableData *pImmutableData = (CFileMappingImmutableData *) pImmData;
+    CFileMappingImmutableData *pImmutableDataTarget = (CFileMappingImmutableData *) pImmDataTarget;
+
+    if (NULL != pImmutableData->lpFileName)
+    {
+        pImmutableDataTarget->lpFileName = strdup(pImmutableData->lpFileName);
+    }
+}
+
+void
+CFileMappingImmutableDataCleanupRoutine(
+    void *pImmData
+    )
+{
+    PAL_ERROR palError = NO_ERROR;
+    CFileMappingImmutableData *pImmutableData = (CFileMappingImmutableData *) pImmData;
+
+    free(pImmutableData->lpFileName);
+}
+
+void
 FileMappingCleanupRoutine(
     CPalThread *pThread,
     IPalObject *pObjectToCleanup,
@@ -184,7 +225,7 @@ FileMappingCleanupRoutine(
 
         if (pImmutableData->bPALCreatedTempFile)
         {
-            unlink(pImmutableData->szFileName);
+            unlink(pImmutableData->lpFileName);
         }
     }
 
@@ -245,7 +286,7 @@ FileMappingInitializationRoutine(
         reinterpret_cast<CFileMappingProcessLocalData *>(pvProcessLocalData);
 
     pProcessLocalData->UnixFd = InternalOpen(
-        pImmutableData->szFileName,
+        pImmutableData->lpFileName,
         MAPProtectionToFileOpenFlags(pImmutableData->flProtect) | O_CLOEXEC
         );
 
@@ -501,16 +542,18 @@ CorUnix::InternalCreateFileMapping(
         //
         
         /* Anonymous mapped files. */
-        if (strcpy_s(pImmutableData->szFileName, sizeof(pImmutableData->szFileName), "/dev/zero") != SAFECRT_SUCCESS)
+        _ASSERTE(pImmutableData->lpFileName == NULL);
+        pImmutableData->lpFileName = strdup("/dev/zero");
+        if (pImmutableData->lpFileName == NULL)
         {
-            ERROR( "strcpy_s failed!\n" );
+            ASSERT("Unable to copy string\n");
             palError = ERROR_INTERNAL_ERROR;
             goto ExitInternalCreateFileMapping;
         }
 
 #if HAVE_MMAP_DEV_ZERO
 
-        UnixFd = InternalOpen(pImmutableData->szFileName, O_RDWR | O_CLOEXEC);
+        UnixFd = InternalOpen(pImmutableData->lpFileName, O_RDWR | O_CLOEXEC);
         if ( -1 == UnixFd )
         {
             ERROR( "Unable to open the file.\n");
@@ -598,10 +641,12 @@ CorUnix::InternalCreateFileMapping(
                 }
                 goto ExitInternalCreateFileMapping;
             }
-  
-            if (strcpy_s(pImmutableData->szFileName, sizeof(pImmutableData->szFileName), pFileLocalData->unix_filename) != SAFECRT_SUCCESS)
+
+            _ASSERTE(pImmutableData->lpFileName == NULL);
+            pImmutableData->lpFileName = strdup(pFileLocalData->unix_filename);
+            if (pImmutableData->lpFileName == NULL)
             {
-                ERROR( "strcpy_s failed!\n" );
+                ASSERT("Unable to copy string\n");
                 palError = ERROR_INTERNAL_ERROR;
                 if (NULL != pFileLocalDataLock)
                 {
@@ -623,7 +668,7 @@ CorUnix::InternalCreateFileMapping(
 
             /* Create a temporary file on the filesystem in order to be 
                shared across processes. */
-            palError = MAPCreateTempFile(pThread, &UnixFd, pImmutableData->szFileName);
+            palError = MAPCreateTempFile(pThread, &UnixFd, pImmutableData->lpFileName);
             if (NO_ERROR != palError)
             {
                 ERROR("Unable to create the temporary file.\n");
@@ -771,7 +816,7 @@ ExitInternalCreateFileMapping:
 
         if (bPALCreatedTempFile)
         {
-            unlink(pImmutableData->szFileName);
+            unlink(pImmutableData->lpFileName);
         }
 
         if (-1 != UnixFd)
@@ -881,63 +926,6 @@ OpenFileMappingW(
     return hFileMapping;
 }
 
-PAL_ERROR
-CorUnix::InternalOpenFileMapping(
-    CPalThread *pThread,
-    DWORD dwDesiredAccess,
-    BOOL bInheritHandle,
-    LPCWSTR lpName,
-    HANDLE *phMapping
-    )
-{
-    PAL_ERROR palError = NO_ERROR;
-    IPalObject *pFileMapping = NULL;
-    CPalString sObjectName(lpName);
-
-    if ( MAPContainsInvalidFlags( dwDesiredAccess ) ) 
-    {
-        ASSERT( "dwDesiredAccess can be one or more of FILE_MAP_READ, " 
-               "FILE_MAP_WRITE, FILE_MAP_COPY or FILE_MAP_ALL_ACCESS.\n" );
-        palError = ERROR_INVALID_PARAMETER;
-        goto ExitInternalOpenFileMapping;
-    }
-
-    palError = g_pObjectManager->LocateObject(
-        pThread,
-        &sObjectName,
-        &aotFileMapping, 
-        &pFileMapping
-        );
-
-    if (NO_ERROR != palError)
-    {
-        goto ExitInternalOpenFileMapping;
-    }
-
-    palError = g_pObjectManager->ObtainHandleForObject(
-        pThread,
-        pFileMapping,
-        dwDesiredAccess,
-        bInheritHandle,
-        NULL,
-        phMapping
-        );
-
-    if (NO_ERROR != palError)
-    {
-        goto ExitInternalOpenFileMapping;
-    }
-
-ExitInternalOpenFileMapping:
-
-    if (NULL != pFileMapping)
-    {
-        pFileMapping->ReleaseReference(pThread);
-    }
-    
-    return palError;
-}
-
 /*++
 Function:
   MapViewOfFile
diff --git a/src/pal/src/objmgr/palobjbase.cpp b/src/pal/src/objmgr/palobjbase.cpp
index 27842f6..0f226b9 100644
--- a/src/pal/src/objmgr/palobjbase.cpp
+++ b/src/pal/src/objmgr/palobjbase.cpp
@@ -314,6 +314,16 @@ CPalObjectBase::ReleaseReference(
                 );
         }
 
+        if (NULL != m_pot->GetImmutableDataCleanupRoutine())
+        {
+            (*m_pot->GetImmutableDataCleanupRoutine())(m_pvImmutableData);
+        }
+
+        if (NULL != m_pot->GetProcessLocalDataCleanupRoutine())
+        {
+            (*m_pot->GetProcessLocalDataCleanupRoutine())(pthr, static_cast<IPalObject*>(this));
+        }
+
         InternalDelete(this);
 
         pthr->ReleaseThreadReference();
diff --git a/src/pal/src/objmgr/shmobject.cpp b/src/pal/src/objmgr/shmobject.cpp
index 2692554..17ef3e4 100644
--- a/src/pal/src/objmgr/shmobject.cpp
+++ b/src/pal/src/objmgr/shmobject.cpp
@@ -242,6 +242,13 @@ CSharedMemoryObject::InitializeFromExistingSharedData(
         if (NULL != pv)
         {
             memcpy(m_pvImmutableData, pv, m_pot->GetImmutableDataSize());
+            if (NULL != psmod->pCopyRoutine)
+            {
+                (*psmod->pCopyRoutine)(pv, m_pvImmutableData);
+            }
+
+            m_pot->SetImmutableDataCopyRoutine(psmod->pCopyRoutine);
+            m_pot->SetImmutableDataCleanupRoutine(psmod->pCleanupRoutine);
         }
         else
         {
@@ -436,6 +443,10 @@ CSharedMemoryObject::FreeSharedDataAreas(
     
     if (NULL != psmod->shmObjImmutableData)
     {
+        if (NULL != psmod->pCleanupRoutine)
+        {
+            (*psmod->pCleanupRoutine)(psmod->shmObjImmutableData);
+        }
         free(psmod->shmObjImmutableData);
     }
 
@@ -458,159 +469,6 @@ CSharedMemoryObject::FreeSharedDataAreas(
 
 /*++
 Function:
-  CSharedMemoryObject::PromoteShjaredData
-
-  Copies the object's state into the passed-in shared data structures
-
-Parameters:
-  shmObjData -- shared memory pointer for the shared memory object data
-  psmod -- locally-mapped pointer for the shared memory object data
---*/
-
-void
-CSharedMemoryObject::PromoteSharedData(
-    SHMPTR shmObjData,
-    SHMObjData *psmod
-    )
-{
-    _ASSERTE(NULL != shmObjData);
-    _ASSERTE(NULL != psmod);
-    
-    ENTRY("CSharedMemoryObject::PromoteSharedData"
-        "(this = %p, shmObjData = %p, psmod = %p)\n",
-        this, 
-        shmObjData,
-        psmod);
-    
-    //
-    // psmod has been zero-inited, so we don't need to worry about
-    // shmPrevObj, shmNextObj, fAddedToList, shmObjName, dwNameLength,
-    // or pvSynchData
-    //
-    
-    psmod->lProcessRefCount = 1;
-    psmod->eTypeId = m_pot->GetId();
-    
-    if (0 != m_pot->GetImmutableDataSize())
-    {
-        void *pvImmutableData;
-
-        pvImmutableData = SHMPTR_TO_TYPED_PTR(void, psmod->shmObjImmutableData);
-        _ASSERTE(NULL != pvImmutableData);
-
-        CopyMemory(
-            pvImmutableData,
-            m_pvImmutableData,
-            m_pot->GetImmutableDataSize()
-            );
-    }
-
-    if (0 != m_pot->GetSharedDataSize())
-    {
-        void *pvSharedData;
-
-        pvSharedData = SHMPTR_TO_TYPED_PTR(void, psmod->shmObjSharedData);
-        _ASSERTE(NULL != pvSharedData);
-
-        CopyMemory(
-            pvSharedData,
-            m_pvSharedData,
-            m_pot->GetSharedDataSize()
-            );
-        
-        free(m_pvSharedData);
-        m_pvSharedData = pvSharedData;
-    }
-
-    m_shmod = shmObjData;
-
-    LOGEXIT("CSharedMemoryObject::PromoteSharedData\n");
-}
-
-/*++
-Function:
-  CSharedMemoryObject::EnsureObjectIsShared
-
-  If this object is not yet in the shared domain allocate the necessary
-  shared memory structures for it and copy the object's data into those
-  structures
-
-Parameters:
-  pthr -- thread data for the calling thread
---*/
-
-PAL_ERROR
-CSharedMemoryObject::EnsureObjectIsShared(
-    CPalThread *pthr
-    )
-{
-    PAL_ERROR palError = NO_ERROR;
-    IDataLock *pDataLock = NULL;
-    SHMPTR shmObjData;
-    SHMObjData *psmod;
-
-    _ASSERTE(NULL != pthr);
-
-    ENTRY("CSharedMemoryObject::EnsureObjectIsShared"
-        "(this = %p, pthr = %p)\n",
-        this,
-        pthr
-        );
-
-    //
-    // Grab the shared memory lock and check if the object is already
-    // shared
-    //
-    
-    SHMLock();
-
-    if (SharedObject == m_ObjectDomain)
-    {
-        goto EnsureObjectIsSharedExit;
-    }
-
-    //
-    // Grab the local shared data lock, if necessary
-    //
-    
-    if (0 != m_pot->GetSharedDataSize())
-    {
-        m_sdlSharedData.AcquireLock(pthr, &pDataLock);
-    }
-
-    //
-    // Allocate the necessary shared data areas
-    //
-
-    palError = AllocateSharedDataItems(&shmObjData, &psmod);
-    if (NO_ERROR != palError)
-    {
-        goto EnsureObjectIsSharedExit;
-    }
-
-    //
-    // Promote the object's data and set the domain to shared
-    //
-
-    PromoteSharedData(shmObjData, psmod);
-    m_ObjectDomain = SharedObject;
-
-EnsureObjectIsSharedExit:
-
-    if (NULL != pDataLock)
-    {
-        pDataLock->ReleaseLock(pthr, TRUE);
-    }
-
-    SHMRelease();
-
-    LOGEXIT("CSharedMemoryObject::EnsureObjectIsShared returns %d\n", palError);
-
-    return palError;    
-}
-
-/*++
-Function:
   CSharedMemoryObject::CleanupForProcessShutdown
 
   Cleanup routine called by the object manager when shutting down
@@ -646,6 +504,16 @@ CSharedMemoryObject::CleanupForProcessShutdown(
             );
     }
 
+    if (NULL != m_pot->GetImmutableDataCleanupRoutine())
+    {
+        (*m_pot->GetImmutableDataCleanupRoutine())(m_pvImmutableData);
+    }
+
+    if (NULL != m_pot->GetProcessLocalDataCleanupRoutine())
+    {
+        (*m_pot->GetProcessLocalDataCleanupRoutine())(pthr, static_cast<IPalObject*>(this));
+    }
+
     //
     // We need to do two things with the calling thread data here:
     // 1) store it in m_pthrCleanup so it is available to the destructors
@@ -1188,126 +1056,6 @@ InitializeExit:
 
 /*++
 Function:
-  CSharedMemoryWaitableObject::EnsureObjectIsShared
-
-  If this object is not yet in the shared domain allocate the necessary
-  shared memory structures for it and copy the object's data into those
-  structures
-
-Parameters:
-  pthr -- thread data for the calling thread
---*/
-
-PAL_ERROR
-CSharedMemoryWaitableObject::EnsureObjectIsShared(
-    CPalThread *pthr
-    )
-{
-    PAL_ERROR palError = NO_ERROR;
-    IDataLock *pDataLock = NULL;
-    SHMPTR shmObjData = NULL;
-    SHMObjData *psmod;
-    VOID *pvSharedSynchData;
-
-    _ASSERTE(NULL != pthr);
-
-    ENTRY("CSharedMemoryWaitableObject::EnsureObjectIsShared"
-        "(this = %p, pthr = %p)\n",
-        this,
-        pthr
-        );
-    
-    //
-    // First, grab the process synchronization lock and check
-    // if the object is already shared
-    //
-
-    g_pSynchronizationManager->AcquireProcessLock(pthr);
-
-    if (SharedObject == m_ObjectDomain)
-    {
-        goto EnsureObjectIsSharedExitNoSHMLockRelease;
-    }
-
-    //
-    // Grab the necessary locks
-    //
-
-    SHMLock();
-
-    if (0 != m_pot->GetSharedDataSize())
-    {
-        m_sdlSharedData.AcquireLock(pthr, &pDataLock);
-    }
-
-    //
-    // Allocate the necessary shared data areas
-    //
-
-    palError = AllocateSharedDataItems(&shmObjData, &psmod);
-    if (NO_ERROR != palError)
-    {
-        goto EnsureObjectIsSharedExit;
-    }
-
-    //
-    // Promote the object's synchronization data
-    //
-
-    palError = g_pSynchronizationManager->PromoteObjectSynchData(
-        pthr,
-        m_pvSynchData,
-        &pvSharedSynchData
-        );
-
-    if (NO_ERROR != palError)
-    {
-        goto EnsureObjectIsSharedExit;
-    }
-
-    m_pvSynchData = pvSharedSynchData;
-    psmod->pvSynchData = pvSharedSynchData;
-
-    //
-    // Promote the object's data and set the domain to shared
-    //
-
-    PromoteSharedData(shmObjData, psmod);
-    m_ObjectDomain = SharedObject;
-
-EnsureObjectIsSharedExit:
-
-    if (NULL != pDataLock)
-    {
-        pDataLock->ReleaseLock(pthr, TRUE);
-    }
-
-    SHMRelease();
-
-EnsureObjectIsSharedExitNoSHMLockRelease:
-
-    g_pSynchronizationManager->ReleaseProcessLock(pthr);
-
-    if (NO_ERROR != palError && NULL != shmObjData)
-    {
-        //
-        // Since shmObjdData is local to this function there's no
-        // need to continue to hold the promotion locks when
-        // freeing the allocated data on error
-        //
-        
-        FreeSharedDataAreas(shmObjData);
-    }
-
-    LOGEXIT("CSharedMemoryWaitableObject::EnsureObjectIsShared returns %d\n",
-        palError
-        );
-
-    return palError;
-}
-
-/*++
-Function:
   CSharedMemoryWaitableObject::~CSharedMemoryWaitableObject
 
   Destructor; should only be called from ReleaseReference
diff --git a/src/pal/src/objmgr/shmobject.hpp b/src/pal/src/objmgr/shmobject.hpp
index 66b9ea9..9d55f90 100644
--- a/src/pal/src/objmgr/shmobject.hpp
+++ b/src/pal/src/objmgr/shmobject.hpp
@@ -65,6 +65,9 @@ namespace CorUnix
         SHMPTR shmObjImmutableData;
         SHMPTR shmObjSharedData;
 
+        OBJECT_IMMUTABLE_DATA_COPY_ROUTINE pCopyRoutine;
+        OBJECT_IMMUTABLE_DATA_CLEANUP_ROUTINE pCleanupRoutine;
+
         LONG lProcessRefCount;
         DWORD dwNameLength;
 
@@ -140,12 +143,6 @@ namespace CorUnix
             SHMPTR shmObjData
             );
 
-        void
-        PromoteSharedData(
-            SHMPTR shmObjData,
-            SHMObjData *psmod
-            );
-
         bool
         DereferenceSharedData();
 
@@ -228,12 +225,6 @@ namespace CorUnix
             CObjectAttributes *poa
             );
 
-        virtual
-        PAL_ERROR
-        EnsureObjectIsShared(
-            CPalThread *pthr
-            );
-
         void
         CleanupForProcessShutdown(
             CPalThread *pthr
@@ -353,12 +344,6 @@ namespace CorUnix
             CObjectAttributes *poa
             );
 
-        virtual
-        PAL_ERROR
-        EnsureObjectIsShared(
-            CPalThread *pthr
-            );
-
         //
         // IPalObject routines
         //
diff --git a/src/pal/src/objmgr/shmobjectmanager.cpp b/src/pal/src/objmgr/shmobjectmanager.cpp
index 755fa46..90caa65 100644
--- a/src/pal/src/objmgr/shmobjectmanager.cpp
+++ b/src/pal/src/objmgr/shmobjectmanager.cpp
@@ -418,6 +418,14 @@ CSharedMemoryObjectManager::RegisterObject(
                     pvImmutableData,
                     potObj->GetImmutableDataSize()
                     );
+
+                if (NULL != potObj->GetImmutableDataCopyRoutine())
+                {
+                    (*potObj->GetImmutableDataCopyRoutine())(pvImmutableData, pvSharedImmutableData);
+                }
+
+                psmod->pCopyRoutine = potObj->GetImmutableDataCopyRoutine();
+                psmod->pCleanupRoutine = potObj->GetImmutableDataCleanupRoutine();
             }
             else
             {
@@ -1174,335 +1182,6 @@ static CAllowedObjectTypes aotRemotable(
 
 /*++
 Function:
-  PAL_LocalHandleToRemote
-
-  Returns a "remote handle" that may be passed to another process.
-
-Parameters:
-  hLocal -- the handle to generate a "remote handle" for
---*/
-
-PALIMPORT
-RHANDLE
-PALAPI
-PAL_LocalHandleToRemote(IN HANDLE hLocal)
-{
-    PAL_ERROR palError = NO_ERROR;
-    CPalThread *pthr;
-    IPalObject *pobj = NULL;
-    CSharedMemoryObject *pshmobj;
-    SHMObjData *psmod = NULL;
-    RHANDLE hRemote = reinterpret_cast<RHANDLE>(INVALID_HANDLE_VALUE);
-
-    PERF_ENTRY(PAL_LocalHandleToRemote);
-    ENTRY("PAL_LocalHandleToRemote( hLocal=0x%lx )\n", hLocal);
-
-    pthr = InternalGetCurrentThread();
-
-    if (!HandleIsSpecial(hLocal))
-    {
-        palError = g_pObjectManager->ReferenceObjectByHandle(
-            pthr,
-            hLocal,
-            &aotRemotable,
-            0,
-            &pobj
-            );
-
-        if (NO_ERROR != palError)
-        {
-            goto PAL_LocalHandleToRemoteExitNoLockRelease;
-        }
-    }
-    else if (hPseudoCurrentProcess == hLocal)
-    {
-        pobj = g_pobjProcess;
-        pobj->AddReference();
-    }
-    else
-    {
-        ASSERT("Invalid special handle type passed to PAL_LocalHandleToRemote\n");
-        palError = ERROR_INVALID_HANDLE;
-        goto PAL_LocalHandleToRemoteExitNoLockRelease;
-    }
-
-    pshmobj = static_cast<CSharedMemoryObject*>(pobj);
-
-    //
-    // Make sure that the object is shared
-    //
-
-    palError = pshmobj->EnsureObjectIsShared(pthr);
-    if (NO_ERROR != palError)
-    {
-        ERROR("Failure %d promoting object\n", palError);
-        goto PAL_LocalHandleToRemoteExitNoLockRelease;
-    }
-
-    SHMLock();
-    
-    psmod = SHMPTR_TO_TYPED_PTR(SHMObjData, pshmobj->GetShmObjData());
-    if (NULL != psmod)
-    {
-        //
-        // Bump up the process ref count by 1. The receiving process will not
-        // increase the ref count when it converts the remote handle to
-        // local.
-        //
-        
-        psmod->lProcessRefCount += 1;
-
-        //
-        // The remote handle is simply the SHMPTR for the SHMObjData
-        //
-
-        hRemote = reinterpret_cast<RHANDLE>(pshmobj->GetShmObjData());
-    }
-    else
-    {
-        ASSERT("Unable to map shared object data\n");
-        palError = ERROR_INTERNAL_ERROR;
-        goto PAL_LocalHandleToRemoteExit;
-    }
-
-PAL_LocalHandleToRemoteExit:
-
-    SHMRelease();
-
-PAL_LocalHandleToRemoteExitNoLockRelease:
-
-    if (NULL != pobj)
-    {
-        pobj->ReleaseReference(pthr);
-    }
-
-    if (NO_ERROR != palError)
-    {
-        pthr->SetLastError(palError);
-    }
-    
-    LOGEXIT("PAL_LocalHandleToRemote returns RHANDLE 0x%lx\n", hRemote);
-    PERF_EXIT(PAL_LocalHandleToRemote);
-    return hRemote;
-}
-
-/*++
-Function:
-  CSharedMemoryObjectManager::ConvertRemoteHandleToLocal
-
-  Given a "remote handle" creates a local handle that refers
-  to the desired object. (Unlike PAL_RemoteHandleToLocal this method
-  needs to access internal object manager state, so it's a member function.)
-
-Parameters:
-  pthr -- thread data for calling thread
-  rhRemote -- the remote handle
-  phLocal -- on success, receives the local handle
---*/
-
-PAL_ERROR
-CSharedMemoryObjectManager::ConvertRemoteHandleToLocal(
-    CPalThread *pthr,
-    RHANDLE rhRemote,
-    HANDLE *phLocal
-    )
-{
-    PAL_ERROR palError = NO_ERROR;
-    SHMObjData *psmod;
-    CSharedMemoryObject *pshmobj = NULL;
-    PLIST_ENTRY pleObjectList;
-
-    _ASSERTE(NULL != pthr);
-    _ASSERTE(NULL != phLocal);
-
-    ENTRY("CSharedMemoryObjectManager::ConvertRemoteHandleToLocal "
-        "(this=%p, pthr=%p, rhRemote=%p, phLocal=%p)\n",
-        this,
-        pthr,
-        rhRemote,
-        phLocal
-        );
-
-    if (rhRemote == NULL || rhRemote == INVALID_HANDLE_VALUE)
-    {
-        palError = ERROR_INVALID_HANDLE;
-        goto ConvertRemoteHandleToLocalExitNoLockRelease;
-    }
-
-    InternalEnterCriticalSection(pthr, &m_csListLock);
-    SHMLock();
-
-    //
-    // The remote handle is really a shared memory pointer to the
-    // SHMObjData for the object.
-    //
-
-    psmod = SHMPTR_TO_TYPED_PTR(SHMObjData, reinterpret_cast<SHMPTR>(rhRemote));
-    if (NULL == psmod)
-    {
-        ERROR("Invalid remote handle\n");
-        palError = ERROR_INVALID_HANDLE;
-        goto ConvertRemoteHandleToLocalExit;
-    }
-
-    //
-    // Check to see if a local reference for this object already
-    // exists
-    //
-
-    if (0 != psmod->dwNameLength)
-    {
-        pleObjectList = &m_leNamedObjects;
-    }
-    else
-    {
-        pleObjectList = &m_leAnonymousObjects;
-    }
-
-    for (PLIST_ENTRY ple = pleObjectList->Flink;
-         ple != pleObjectList;
-         ple = ple->Flink)
-    {
-        pshmobj = CSharedMemoryObject::GetObjectFromListLink(ple);
-
-        if (SharedObject == pshmobj->GetObjectDomain()
-            && reinterpret_cast<SHMPTR>(rhRemote) == pshmobj->GetShmObjData())
-        {
-            TRACE("Object for remote handle already present in this process\n");
-            
-            //
-            // PAL_LocalHandleToRemote bumped up the process refcount on the
-            // object. Since this process already had a reference to the object
-            // we need to decrement that reference now...
-            //
-
-            psmod->lProcessRefCount -= 1;
-            _ASSERTE(0 < psmod->lProcessRefCount);
-
-            //
-            // We also need to add a reference to the object (since ReleaseReference
-            // gets called below)
-            //
-
-            pshmobj->AddReference();
-
-            break;
-        }
-
-        pshmobj = NULL;
-    }
-
-    if (NULL == pshmobj)
-    {
-        CObjectType *pot;
-        CObjectAttributes oa;
-        
-        //
-        // Get the local instance of the CObjectType
-        //
-        
-        pot = CObjectType::GetObjectTypeById(psmod->eTypeId);
-        if (NULL == pot)
-        {
-            ASSERT("Invalid object type ID in shared memory info\n");
-            goto ConvertRemoteHandleToLocalExit;
-        }
-        
-        //
-        // Create the local state for the shared object
-        //
-
-        palError = ImportSharedObjectIntoProcess(
-            pthr,
-            pot,
-            &oa,
-            reinterpret_cast<SHMPTR>(rhRemote),
-            psmod,
-            FALSE,
-            &pshmobj
-            );
-
-        if (NO_ERROR != palError)
-        {
-            goto ConvertRemoteHandleToLocalExit;
-        }        
-    }
-
-    //
-    // Finally, allocate a local handle for the object
-    //
-
-    palError = ObtainHandleForObject(
-        pthr,
-        pshmobj,
-        0,
-        FALSE,
-        NULL,
-        phLocal
-        );
-        
-ConvertRemoteHandleToLocalExit:
-
-    SHMRelease();
-    InternalLeaveCriticalSection(pthr, &m_csListLock);
-
-ConvertRemoteHandleToLocalExitNoLockRelease:
-
-    if (NULL != pshmobj)
-    {
-        pshmobj->ReleaseReference(pthr);
-    }
-
-    LOGEXIT("CSharedMemoryObjectManager::ConvertRemoteHandleToLocal returns %d\n", palError);
-
-    return palError;
-}
-
-/*++
-Function:
-  PAL_RemoteHandleToLocal
-
-  Given a "remote handle", return a local handle that refers to the
-  specified process. Calls
-  SharedMemoryObjectManager::ConvertRemoteHandleToLocal to do the actual
-  work
-
-Parameters:
-  rhRemote -- the "remote handle" to convert to a local handle
---*/
-
-PALIMPORT
-HANDLE
-PALAPI
-PAL_RemoteHandleToLocal(IN RHANDLE rhRemote)
-{
-    PAL_ERROR palError = NO_ERROR;
-    CPalThread *pthr;
-    HANDLE hLocal = INVALID_HANDLE_VALUE;
-
-    PERF_ENTRY(PAL_RemoteHandleToLocal);
-    ENTRY("PAL_RemoteHandleToLocal( hRemote=0x%lx )\n", rhRemote);
-
-    pthr = InternalGetCurrentThread();
-
-    palError = static_cast<CSharedMemoryObjectManager*>(g_pObjectManager)->ConvertRemoteHandleToLocal(
-        pthr,
-        rhRemote,
-        &hLocal
-        );
-
-    if (NO_ERROR != palError)
-    {
-        pthr->SetLastError(palError);
-    }
-    
-    LOGEXIT("PAL_RemoteHandleToLocal returns HANDLE 0x%lx\n", hLocal);
-    PERF_EXIT(PAL_RemoteHandleToLocal);
-    return hLocal;
-}
-
-/*++
-Function:
   CheckObjectTypeAndRights
 
   Helper routine that determines if:
diff --git a/src/pal/src/objmgr/shmobjectmanager.hpp b/src/pal/src/objmgr/shmobjectmanager.hpp
index fbde872..6e11b20 100644
--- a/src/pal/src/objmgr/shmobjectmanager.hpp
+++ b/src/pal/src/objmgr/shmobjectmanager.hpp
@@ -71,13 +71,6 @@ namespace CorUnix
             CPalThread *pthr
             );
 
-        PAL_ERROR
-        ConvertRemoteHandleToLocal(
-            CPalThread *pthr,
-            RHANDLE rhRemote,
-            HANDLE *phLocal
-            );
-
         //
         // IPalObjectManager routines
         //
diff --git a/src/pal/src/synchobj/event.cpp b/src/pal/src/synchobj/event.cpp
index 54addad..3d15917 100644
--- a/src/pal/src/synchobj/event.cpp
+++ b/src/pal/src/synchobj/event.cpp
@@ -35,7 +35,10 @@ CObjectType CorUnix::otManualResetEvent(
                 NULL,   // No cleanup routine
                 NULL,   // No initialization routine
                 0,      // No immutable data
+                NULL,   // No immutable data copy routine
+                NULL,   // No immutable data cleanup routine
                 0,      // No process local data
+                NULL,   // No process local data cleanup routine
                 0,      // No shared data
                 EVENT_ALL_ACCESS, // Currently ignored (no Win32 security)
                 CObjectType::SecuritySupported,
@@ -53,7 +56,10 @@ CObjectType CorUnix::otAutoResetEvent(
                 NULL,   // No cleanup routine
                 NULL,   // No initialization routine
                 0,      // No immutable data
+                NULL,   // No immutable data copy routine
+                NULL,   // No immutable data cleanup routine
                 0,      // No process local data
+                NULL,   // No process local data cleanup routine
                 0,      // No shared data
                 EVENT_ALL_ACCESS, // Currently ignored (no Win32 security)
                 CObjectType::SecuritySupported,
@@ -506,84 +512,4 @@ OpenEventWExit:
     PERF_EXIT(OpenEventW);
 
     return hEvent;
-}
-
-/*++
-Function:
-  InternalOpenEvent
-
-Note:
-  dwDesiredAccess is currently ignored (no Win32 object security support)
-  bInheritHandle is currently ignored (handles to events are not inheritable)
-
-Parameters:
-  pthr -- thread data for calling thread
-  phEvent -- on success, receives the allocated event handle
-  
-  See MSDN docs on OpenEvent for all other parameters.
---*/
-
-PAL_ERROR
-CorUnix::InternalOpenEvent(
-    CPalThread *pthr,
-    DWORD dwDesiredAccess,
-    BOOL bInheritHandle,
-    LPCWSTR lpName,
-    HANDLE *phEvent
-    )
-{
-    PAL_ERROR palError = NO_ERROR;
-    IPalObject *pobjEvent = NULL;
-    CPalString sObjectName(lpName);
-
-    _ASSERTE(NULL != pthr);
-    _ASSERTE(NULL != lpName);
-    _ASSERTE(NULL != phEvent);
-
-    ENTRY("InternalOpenEvent(pthr=%p, dwDesiredAccess=%#x, bInheritHandle=%d, "
-        "lpName=%p, phEvent=%p)\n",
-        pthr,
-        dwDesiredAccess,
-        bInheritHandle,
-        lpName,
-        phEvent
-        );
-
-    palError = g_pObjectManager->LocateObject(
-        pthr,
-        &sObjectName,
-        &aotEvent,
-        &pobjEvent
-        );
-
-    if (NO_ERROR != palError)
-    {
-        goto InternalOpenEventExit;
-    }
-
-    palError = g_pObjectManager->ObtainHandleForObject(
-        pthr,
-        pobjEvent,
-        dwDesiredAccess,
-        bInheritHandle,
-        NULL,
-        phEvent
-        );
-
-    if (NO_ERROR != palError)
-    {
-        goto InternalOpenEventExit;
-    }
-
-InternalOpenEventExit:
-
-    if (NULL != pobjEvent)
-    {
-        pobjEvent->ReleaseReference(pthr);
-    }
-
-    LOGEXIT("InternalOpenEvent returns %d\n", palError);
-    
-    return palError;
-}
-
+}
\ No newline at end of file
diff --git a/src/pal/src/synchobj/mutex.cpp b/src/pal/src/synchobj/mutex.cpp
index 692f5e2..fbbaf17 100644
--- a/src/pal/src/synchobj/mutex.cpp
+++ b/src/pal/src/synchobj/mutex.cpp
@@ -49,7 +49,10 @@ CObjectType CorUnix::otMutex(
                 NULL,   // No cleanup routine
                 NULL,   // No initialization routine
                 0,      // No immutable data
+                NULL,   // No immutable data copy routine
+                NULL,   // No immutable data cleanup routine
                 0,      // No process local data
+                NULL,   // No process local data cleanup routine
                 0,      // No shared data
                 0,      // Should be MUTEX_ALL_ACCESS; currently ignored (no Win32 security)
                 CObjectType::SecuritySupported,
@@ -69,7 +72,10 @@ CObjectType CorUnix::otNamedMutex(
                 &SharedMemoryProcessDataHeader::PalObject_Close, // Cleanup routine
                 NULL,   // No initialization routine
                 sizeof(SharedMemoryProcessDataHeader *), // Immutable data
+                NULL,   // No immutable data copy routine
+                NULL,   // No immutable data cleanup routine
                 0,      // No process local data
+                NULL,   // No process local data cleanup routine
                 0,      // No shared data
                 0,      // Should be MUTEX_ALL_ACCESS; currently ignored (no Win32 security)
                 CObjectType::SecuritySupported,
diff --git a/src/pal/src/synchobj/semaphore.cpp b/src/pal/src/synchobj/semaphore.cpp
index b224018..5f8cf72 100644
--- a/src/pal/src/synchobj/semaphore.cpp
+++ b/src/pal/src/synchobj/semaphore.cpp
@@ -35,7 +35,10 @@ CObjectType CorUnix::otSemaphore(
                 NULL,   // No cleanup routine
                 NULL,   // No initialization routine
                 sizeof(SemaphoreImmutableData),
+                NULL,   // No immutable data copy routine
+                NULL,   // No immutable data cleanup routine
                 0,      // No process local data
+                NULL,   // No process local data cleanup routine
                 0,      // No shared data
                 0,      // Should be SEMAPHORE_ALL_ACCESS; currently ignored (no Win32 security)
                 CObjectType::SecuritySupported,
@@ -597,84 +600,4 @@ OpenSemaphoreW(
     PERF_EXIT(OpenSemaphoreW);
 
     return hSemaphore;
-}
-
-/*++
-Function:
-  InternalOpenSemaphore
-
-Note:
-  dwDesiredAccess is currently ignored (no Win32 object security support)
-  bInheritHandle is currently ignored (handles to semaphores are not inheritable)
-
-Parameters:
-  pthr -- thread data for calling thread
-  phEvent -- on success, receives the allocated semaphore handle
-  
-  See MSDN docs on OpenSemaphore for all other parameters.
---*/
-
-PAL_ERROR
-CorUnix::InternalOpenSemaphore(
-    CPalThread *pthr,
-    DWORD dwDesiredAccess,
-    BOOL bInheritHandle,
-    LPCWSTR lpName,
-    HANDLE *phSemaphore
-    )
-{
-    PAL_ERROR palError = NO_ERROR;
-    IPalObject *pobjSemaphore = NULL;
-    CPalString sObjectName(lpName);
-
-    _ASSERTE(NULL != pthr);
-    _ASSERTE(NULL != lpName);
-    _ASSERTE(NULL != phSemaphore);
-
-    ENTRY("InternalOpenSemaphore(pthr=%p, dwDesiredAccess=%d, bInheritHandle=%d, "
-        "lpName=%p, phSemaphore=%p)\n",
-        pthr,
-        dwDesiredAccess,
-        bInheritHandle,
-        phSemaphore
-        );
-
-    palError = g_pObjectManager->LocateObject(
-        pthr,
-        &sObjectName,
-        &aotSempahore,
-        &pobjSemaphore
-        );
-
-    if (NO_ERROR != palError)
-    {
-        goto InternalOpenSemaphoreExit;
-    }
-
-    palError = g_pObjectManager->ObtainHandleForObject(
-        pthr,
-        pobjSemaphore,
-        dwDesiredAccess,
-        bInheritHandle,
-        NULL,
-        phSemaphore
-        );
-
-    if (NO_ERROR != palError)
-    {
-        goto InternalOpenSemaphoreExit;
-    }
-
-InternalOpenSemaphoreExit:
-
-    if (NULL != pobjSemaphore)
-    {
-        pobjSemaphore->ReleaseReference(pthr);
-    }
-
-    LOGEXIT("InternalOpenSemaphore returns %d\n", palError);
-    
-    return palError;
-}
-
-
+}
\ No newline at end of file
diff --git a/src/pal/src/thread/process.cpp b/src/pal/src/thread/process.cpp
index e22d268..e882cba 100644
--- a/src/pal/src/thread/process.cpp
+++ b/src/pal/src/thread/process.cpp
@@ -78,11 +78,14 @@ using namespace CorUnix;
 
 CObjectType CorUnix::otProcess(
                 otiProcess,
-                NULL,
-                NULL,
-                0,
+                NULL,   // No cleanup routine
+                NULL,   // No initialization routine
+                0,      // No immutable data
+                NULL,   // No immutable data copy routine
+                NULL,   // No immutable data cleanup routine
                 sizeof(CProcProcessLocalData),
-                0,
+                NULL,   // No process local data cleanup routine
+                0,      // No shared data
                 PROCESS_ALL_ACCESS,
                 CObjectType::SecuritySupported,
                 CObjectType::SecurityInfoNotPersisted,
diff --git a/src/pal/src/thread/thread.cpp b/src/pal/src/thread/thread.cpp
index df42ebc..15de659 100644
--- a/src/pal/src/thread/thread.cpp
+++ b/src/pal/src/thread/thread.cpp
@@ -130,10 +130,13 @@ CObjectType CorUnix::otThread(
                 otiThread,
                 ThreadCleanupRoutine,
                 ThreadInitializationRoutine,
-                0, //sizeof(CThreadImmutableData),
+                0,      // sizeof(CThreadImmutableData),
+                NULL,   // No immutable data copy routine
+                NULL,   // No immutable data cleanup routine
                 sizeof(CThreadProcessLocalData),
-                0, //sizeof(CThreadSharedData),
-                0, // THREAD_ALL_ACCESS,
+                NULL,   // No process local data cleanup routine
+                0,      // sizeof(CThreadSharedData),
+                0,      // THREAD_ALL_ACCESS,
                 CObjectType::SecuritySupported,
                 CObjectType::SecurityInfoNotPersisted,
                 CObjectType::UnnamedObject,
-- 
2.7.4