/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// NB: This code may be used from non-XPCOM code, in particular, the // Windows Default Browser Agent.
// HGLOBAL is just a typedef of HANDLE which nsSimpleRef has a specialization // of, that means having a nsAutoRefTraits specialization for HGLOBAL is // useless. Therefore we create a wrapper class for HGLOBAL to make // nsAutoRefTraits and nsAutoRef work as intention. class nsHGLOBAL { public:
MOZ_IMPLICIT nsHGLOBAL(HGLOBAL hGlobal) : m_hGlobal(hGlobal) {}
// Because Printer's HANDLE uses ClosePrinter and we already have // nsAutoRef<HANDLE> which uses CloseHandle so we need to create a wrapper class // for HANDLE to have another specialization for nsAutoRefTraits. class nsHPRINTER { public:
MOZ_IMPLICIT nsHPRINTER(HANDLE hPrinter) : m_hPrinter(hPrinter) {}
operator HANDLE() const { return m_hPrinter; }
HANDLE* operator&() { return &m_hPrinter; }
private:
HANDLE m_hPrinter;
};
// winspool.h header has AddMonitor macro, it conflicts with AddMonitor member // function in TaskbarPreview.cpp and TaskbarTabPreview.cpp. Beside, we only // need ClosePrinter here for Release function, so having its prototype is // enough. extern"C"BOOL WINAPI ClosePrinter(HANDLE hPrinter);
// Construct a path "<system32>\<aModule>". return false if the output buffer // is too small. // Note: If the system path cannot be found, or doesn't fit in the output buffer // with the module name, we will just ignore the system path and output the // module name alone; // this may mean using a normal search path wherever the output is used. boolinline ConstructSystem32Path(LPCWSTR aModule, WCHAR* aSystemPath,
UINT aSize) {
MOZ_ASSERT(aSystemPath);
size_t fileLen = wcslen(aModule); if (fileLen >= aSize) { // The module name alone cannot even fit! returnfalse;
}
if (systemDirLen) { if (systemDirLen < aSize - fileLen) { // Make the system directory path terminate with a slash. if (aSystemPath[systemDirLen - 1] != L'\\') { if (systemDirLen + 1 < aSize - fileLen) {
aSystemPath[systemDirLen] = L'\\';
++systemDirLen; // No need to re-nullptr terminate.
} else { // Couldn't fit the system path with added slash.
systemDirLen = 0;
}
}
} else { // Couldn't fit the system path.
systemDirLen = 0;
}
}
// for UniquePtr to store a PSID struct FreeSidDeleter { voidoperator()(void* aPtr) { ::FreeSid(aPtr); }
}; // Unfortunately, although SID is a struct, PSID is a void* // This typedef will work for storing a PSID in a UniquePtr and should make // things a bit more readable. typedef mozilla::UniquePtr<void, FreeSidDeleter> UniqueSidPtr;
// One caller of this function is early in startup and several others are not, // so they have different ways of determining the two parameters. This function // exists just so any future code that needs to determine whether the dynamic // blocklist is disabled remembers to check whether safe mode is active. inlinebool IsDynamicBlocklistDisabled(bool isSafeMode, bool hasCommandLineDisableArgument) { return isSafeMode || hasCommandLineDisableArgument;
} #endif
¤ Dauer der Verarbeitung: 0.20 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.