Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/plugin/PluginClass.cpp

Issue 5117917230268416: No issue - remove dead code (Closed)
Patch Set: Created Oct. 8, 2014, 2:46 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « adblockplus.gyp ('k') | src/plugin/PluginDomTraverser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include "PluginClass.h" 3 #include "PluginClass.h"
4 #include "PluginSettings.h" 4 #include "PluginSettings.h"
5 #include "PluginSystem.h" 5 #include "PluginSystem.h"
6 #include "PluginFilter.h" 6 #include "PluginFilter.h"
7 #include "PluginMimeFilterClient.h" 7 #include "PluginMimeFilterClient.h"
8 #include "PluginClient.h" 8 #include "PluginClient.h"
9 #include "PluginClientFactory.h" 9 #include "PluginClientFactory.h"
10 #include "PluginMutex.h" 10 #include "PluginMutex.h"
(...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 HINSTANCE hInstance = _AtlBaseModule.GetModuleInstance(); 1146 HINSTANCE hInstance = _AtlBaseModule.GetModuleInstance();
1147 1147
1148 HMENU hMenu = ::LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENU1)); 1148 HMENU hMenu = ::LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENU1));
1149 1149
1150 HMENU hMenuTrackPopup = GetSubMenu(hMenu, 0); 1150 HMENU hMenuTrackPopup = GetSubMenu(hMenu, 0);
1151 1151
1152 SetMenuBar(hMenuTrackPopup, url); 1152 SetMenuBar(hMenuTrackPopup, url);
1153 1153
1154 return hMenuTrackPopup; 1154 return hMenuTrackPopup;
1155 } 1155 }
1156 BOOL CreateLowProcess(WCHAR* wszProcessName, WCHAR* cmdLine)
1157 {
1158
1159 BOOL fRet;
1160 HANDLE hToken = NULL;
1161 HANDLE hNewToken = NULL;
1162 PSID pIntegritySid = NULL;
1163 TOKEN_MANDATORY_LABEL TIL = {0};
1164 PROCESS_INFORMATION ProcInfo = {0};
1165 STARTUPINFO StartupInfo = {0};
1166
1167
1168
1169 // Low integrity SID
1170 WCHAR wszIntegritySid[20] = L"S-1-16-4096";
1171
1172
1173 fRet = OpenProcessToken(GetCurrentProcess(),
1174 TOKEN_DUPLICATE |
1175 TOKEN_ADJUST_DEFAULT |
1176 TOKEN_QUERY |
1177 TOKEN_ASSIGN_PRIMARY,
1178 &hToken);
1179
1180 if (!fRet)
1181 {
1182 goto CleanExit;
1183 }
1184
1185 fRet = DuplicateTokenEx(hToken,
1186 0,
1187 NULL,
1188 SecurityImpersonation,
1189 TokenPrimary,
1190 &hNewToken);
1191
1192 if (!fRet)
1193 {
1194 goto CleanExit;
1195 }
1196
1197 fRet = ConvertStringSidToSid(wszIntegritySid, &pIntegritySid);
1198
1199 if (!fRet)
1200 {
1201 goto CleanExit;
1202 }
1203
1204
1205 TIL.Label.Attributes = SE_GROUP_INTEGRITY;
1206 TIL.Label.Sid = pIntegritySid;
1207
1208
1209 //
1210 // Set the process integrity level
1211 //
1212
1213 fRet = SetTokenInformation(hNewToken,
1214 TokenIntegrityLevel,
1215 &TIL,
1216 sizeof(TOKEN_MANDATORY_LABEL) + GetLengthSid(pIntegritySid));
1217
1218 if (!fRet)
1219 {
1220 goto CleanExit;
1221 }
1222
1223 //
1224 // Create the new process at Low integrity
1225 //
1226
1227 fRet = CreateProcessAsUser(hNewToken,
1228 wszProcessName,
1229 cmdLine,
1230 NULL,
1231 NULL,
1232 FALSE,
1233 0,
1234 NULL,
1235 NULL,
1236 &StartupInfo,
1237 &ProcInfo);
1238
1239
1240 CleanExit:
1241
1242 if (ProcInfo.hProcess != NULL)
1243 {
1244 CloseHandle(ProcInfo.hProcess);
1245 }
1246
1247 if (ProcInfo.hThread != NULL)
1248 {
1249 CloseHandle(ProcInfo.hThread);
1250 }
1251
1252 LocalFree(pIntegritySid);
1253
1254 if (hNewToken != NULL)
1255 {
1256 CloseHandle(hNewToken);
1257 }
1258
1259 if (hToken != NULL)
1260 {
1261 CloseHandle(hToken);
1262 }
1263
1264 return fRet;
1265 }
1266 1156
1267 void CPluginClass::DisplayPluginMenu(HMENU hMenu, int nToolbarCmdID, POINT pt, U INT nMenuFlags) 1157 void CPluginClass::DisplayPluginMenu(HMENU hMenu, int nToolbarCmdID, POINT pt, U INT nMenuFlags)
1268 { 1158 {
1269 CPluginClient* client = CPluginClient::GetInstance(); 1159 CPluginClient* client = CPluginClient::GetInstance();
1270 1160
1271 // Create menu parent window 1161 // Create menu parent window
1272 HWND hMenuWnd = ::CreateWindowEx( 1162 HWND hMenuWnd = ::CreateWindowEx(
1273 NULL, 1163 NULL,
1274 MAKEINTATOM(GetAtomPaneClass()), 1164 MAKEINTATOM(GetAtomPaneClass()),
1275 L"", 1165 L"",
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
1975 } 1865 }
1976 } 1866 }
1977 } 1867 }
1978 1868
1979 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); 1869 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT);
1980 } 1870 }
1981 1871
1982 return hTabWnd; 1872 return hTabWnd;
1983 1873
1984 } 1874 }
OLDNEW
« no previous file with comments | « adblockplus.gyp ('k') | src/plugin/PluginDomTraverser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld