michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * vim: sw=2 ts=8 et : michael@0: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include michael@0: michael@0: #include "mozilla/ipc/SharedMemory.h" michael@0: michael@0: namespace mozilla { michael@0: namespace ipc { michael@0: michael@0: void michael@0: SharedMemory::SystemProtect(char* aAddr, size_t aSize, int aRights) michael@0: { michael@0: DWORD flags; michael@0: if ((aRights & RightsRead) && (aRights & RightsWrite)) michael@0: flags = PAGE_READWRITE; michael@0: else if (aRights & RightsRead) michael@0: flags = PAGE_READONLY; michael@0: else michael@0: flags = PAGE_NOACCESS; michael@0: michael@0: DWORD oldflags; michael@0: if (!VirtualProtect(aAddr, aSize, flags, &oldflags)) michael@0: NS_RUNTIMEABORT("can't VirtualProtect()"); michael@0: } michael@0: michael@0: size_t michael@0: SharedMemory::SystemPageSize() michael@0: { michael@0: SYSTEM_INFO si; michael@0: GetSystemInfo(&si); michael@0: return si.dwPageSize; michael@0: } michael@0: michael@0: } // namespace ipc michael@0: } // namespace mozilla