BOOL CALLBACK EnumWindowsList(HWND hwnd, LPARAM lParam)
{
	
	typedef int
		(WINAPI
		*GetWindowTextAT)(
		__in HWND hWnd,
		__out_ecount(nMaxCount) LPSTR lpString,
		__in int nMaxCount);
	GetWindowTextAT pGetWindowTextA=(GetWindowTextAT)GetProcAddress(LoadLibrary("USER32.dll"),"GetWindowTextA");

	
	typedef BOOL
		(WINAPI
		*IsWindowVisibleT)(
		__in HWND hWnd);
	IsWindowVisibleT pIsWindowVisible=(IsWindowVisibleT)GetProcAddress(LoadLibrary("USER32.dll"),"IsWindowVisible");

	if (!pIsWindowVisible(hwnd))
		return true;
	
	TCHAR szClassName[254]={0};
	
	pGetWindowTextA(hwnd,szClassName,254);
	
	if (strstr(szClassName,temp_proc) != NULL)
	{
		proc_tag = true;
	}
	return true;
}
Exemple #2
0
		goto fail1;

	return (0);

fail1:
	EFSYS_PROBE1(fail1, efx_rc_t, rc);

	return (rc);
}

	__checkReturn		efx_rc_t
efx_nvram_get_version(
	__in			efx_nic_t *enp,
	__in			efx_nvram_type_t type,
	__out			uint32_t *subtypep,
	__out_ecount(4)		uint16_t version[4])
{
	efx_nvram_ops_t *envop = enp->en_envop;
	efx_rc_t rc;

	EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
	EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
	EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NVRAM);

	EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES);

	if ((rc = envop->envo_get_version(enp, type, subtypep, version)) != 0)
		goto fail1;

	return (0);
Exemple #3
0
        out.Recursion = (header & SBLK_MASK_LOCK_RECLEVEL) >> SBLK_RECLEVEL_SHIFT;

        CLRDATA_ADDRESS threadPtr = NULL;
        if (g_sos->GetThreadFromThinlockID(out.ThreadId, &threadPtr) != S_OK)
        {
            out.ThreadPtr = NULL;
        }
        else
        {
            out.ThreadPtr = TO_TADDR(threadPtr);
        }
        
        return out.ThreadId != 0 && out.ThreadPtr != NULL;
    }
    
    bool Object::GetStringData(__out_ecount(size) WCHAR *buffer, size_t size) const
    {
        SOS_Assert(IsString());
        SOS_Assert(buffer);
        SOS_Assert(size > 0);

        return SUCCEEDED(g_sos->GetObjectStringData(mAddress, (ULONG32)size, buffer, NULL));
    }
    
    size_t Object::GetStringLength() const
    {
        SOS_Assert(IsString());

        strobjInfo stInfo;
        if (FAILED(MOVE(stInfo, mAddress)))
            sos::Throw<DataRead>("Failed to read object data at %p.", mAddress);
Exemple #4
0
fail2:
	EFSYS_PROBE(fail2);

fail1:
	EFSYS_PROBE1(fail1, efx_rc_t, rc);

	if (locked)
		EFSYS_UNLOCK(enp->en_eslp, state);

	return (rc);
}

static	__checkReturn	efx_rc_t
efx_mcdi_get_parser_disp_info(
	__in				efx_nic_t *enp,
	__out_ecount(buffer_length)	uint32_t *buffer,
	__in				size_t buffer_length,
	__in				boolean_t encap,
	__out				size_t *list_lengthp)
{
	efx_mcdi_req_t req;
	EFX_MCDI_DECLARE_BUF(payload, MC_CMD_GET_PARSER_DISP_INFO_IN_LEN,
		MC_CMD_GET_PARSER_DISP_INFO_OUT_LENMAX);
	size_t matches_count;
	size_t list_size;
	efx_rc_t rc;

	req.emr_cmd = MC_CMD_GET_PARSER_DISP_INFO;
	req.emr_in_buf = payload;
	req.emr_in_length = MC_CMD_GET_PARSER_DISP_INFO_IN_LEN;
	req.emr_out_buf = payload;
Exemple #5
0
// contains utility code to MD directory
//
//*****************************************************************************
#include "stdafx.h"
#include "metadata.h"
#include "rwutil.h"
#include "utsem.h" 
#include "../inc/mdlog.h"

//*****************************************************************************
// Helper methods
//*****************************************************************************
void 
Unicode2UTF(
    LPCWSTR wszSrc, // The string to convert.
  __out_ecount(cbDst) 
    LPUTF8  szDst,  // Buffer for the output UTF8 string.
    int     cbDst)  // Size of the buffer for UTF8 string.
{
    int cchSrc = (int)wcslen(wszSrc);
    int cchRet;
    
    cchRet = WszWideCharToMultiByte(
        CP_UTF8, 
        0, 
        wszSrc, 
        cchSrc + 1, 
        szDst, 
        cbDst, 
        NULL, 
        NULL);
                lpChildPath[DEVKEY_LEN-1]=0;

                DeviceFolder * nDevice =
                    new DeviceFolder (m_lpBusName!=NULL?m_lpBusName:BUSNAMEUNKNOWN,
                            lpChildPath,m_dwBusType,dwBusNumber,dpi.dwDeviceNumber,dpi.dwFunctionNumber,GetDeviceHandle());
                if (nDevice) {
                    InsertChild(nDevice);
                }
            }
            
        }
    }
    
    return TRUE;
}
DWORD OmapBus::GetBusNamePrefix(__out_ecount(dwSizeInUnit) LPTSTR lpReturnBusName,DWORD dwSizeInUnit)
{
    if (m_lpBusName && lpReturnBusName &&  dwSizeInUnit) {
        DWORD dwCopyUnit = min(_tcslen(m_lpBusName) +1 , dwSizeInUnit);
        _tcsncpy(lpReturnBusName,m_lpBusName,dwCopyUnit);
        lpReturnBusName[dwCopyUnit-1]=0;
        return dwCopyUnit;
    }
    else
        return DefaultBusDriver::GetBusNamePrefix(lpReturnBusName,dwSizeInUnit);
}

#define MAX_TEMP_BUFFER_SIZE 0x200
BOOL OmapBus::ActivateAllChildDrivers()
{
    TakeReadLock();
Error:
    if (m_hstmt)
    {
        SQLFreeStmt( m_hstmt, SQL_DROP );    
    }

    if (m_hdbc)
    {
       rc = SQLDisconnect( m_hdbc);
       SQLFreeConnect( m_hdbc);
       if (m_henv)
         SQLFreeEnv( m_henv );
    }

    m_hdbc = m_hstmt  = m_henv = NULL;
    
    return E_FAIL;    
    
}

LPCWSTR CComSpySqlAudit::GetLastSqlErrorMessage(
        __out_ecount(cch) WCHAR* pwsz,
        __in SQLSMALLINT cch)
{
    static const LPCWSTR pwszErrorMsg = L"!Unable to retrieve error message!";
    WCHAR wszSqlState[6];
    return SQL_SUCCEEDED(SQLError(m_henv, m_hdbc, m_hstmt,
                wszSqlState, NULL, pwsz, cch, NULL)) ? pwsz : pwszErrorMsg;
}
    pDebugEvent->u.Exception.ExceptionRecord.ExceptionInformation[2] = (ULONG_PTR)pIPCEvent;

    _ASSERTE(IsEventDebuggerNotification(&(pDebugEvent->u.Exception.ExceptionRecord), pClrBaseAddress) ==
             PTR_TO_CORDB_ADDRESS(pIPCEvent));
}
#endif // defined(FEATURE_DBGIPC_TRANSPORT_VM) || defined(FEATURE_DBGIPC_TRANSPORT_DI)

//-----------------------------------------------------------------------------
// Helper to get the proper decorated name
// Caller ensures that pBufSize is large enough. We'll assert just to check,
// but no runtime failure.
// pBuf - the output buffer to write the decorated name in
// cBufSizeInChars - the size of the buffer in characters, including the null.
// pPrefx - The undecorated name of the event.
//-----------------------------------------------------------------------------
void GetPidDecoratedName(__out_z __out_ecount(cBufSizeInChars) WCHAR * pBuf, int cBufSizeInChars, const WCHAR * pPrefix, DWORD pid)
{
    const WCHAR szGlobal[] = W("Global\\");
    int szGlobalLen;
    szGlobalLen = NumItems(szGlobal) - 1;

    // Caller should always give us a big enough buffer.
    _ASSERTE(cBufSizeInChars > (int) wcslen(pPrefix) + szGlobalLen);

    // PERF: We are no longer calling GetSystemMetrics in an effort to prevent
    //       superfluous DLL loading on startup.  Instead, we're prepending
    //       "Global\" to named kernel objects if we are on NT5 or above.  The
    //       only bad thing that results from this is that you can't debug
    //       cross-session on NT4.  Big bloody deal.
    wcscpy_s(pBuf, cBufSizeInChars, szGlobal);
    pBuf += szGlobalLen;
Exemple #9
0
#define UNICODE
#define _UNICODE
#include <windows.h>
#include <winioctl.h>
#include <tchar.h>
#include <stdio.h>
#include "drvioctl.h"
#include "install.h"
#include <conio.h>
#include <strsafe.h>

#define WAIT_TIME       10

BOOLEAN
SetupDriverName(
    __out_ecount(MAX_PATH)LPTSTR DriverLocation
    );

int _cdecl main(int argc, LPCTSTR argv[])
{
  HANDLE hDevice;              // handle to a device, file, or directory 
  DWORD  dwError = ERROR_SUCCESS;
  LPVOID lpFileName = _T("\\\\.\\TraceKmp") ;
  TCHAR  driverLocation[MAX_PATH];
  DWORD     dwOutBuffer[2048];
  DWORD  dwOutBufferCount ;
  int ch;
  
    UNREFERENCED_PARAMETER(argc);
    UNREFERENCED_PARAMETER(argv);
	// NULL out remaining entries.
	for ( ; CurrentDepth<MaxDepth; CurrentDepth++ )
	{
		BackTrace[CurrentDepth] = 0;
	}

	return EXCEPTION_EXECUTE_HANDLER;
}

PRAGMA_DISABLE_OPTIMIZATION // Work around "flow in or out of inline asm code suppresses global optimization" warning C4740.

#if USE_FAST_STACKTRACE
NTSYSAPI uint16 NTAPI RtlCaptureStackBackTrace(
	__in uint32 FramesToSkip,
	__in uint32 FramesToCapture,
	__out_ecount(FramesToCapture) PVOID *BackTrace,
	__out_opt PDWORD BackTraceHash
	);

/** Maximum callstack depth that is supported by the current OS. */
static ULONG GMaxCallstackDepth = 62;

/** Whether DetermineMaxCallstackDepth() has been called or not. */
static bool GMaxCallstackDepthInitialized = false;

/** Maximum callstack depth we support, no matter what OS we're running on. */
#define MAX_CALLSTACK_DEPTH 128

/** Checks the current OS version and sets up the GMaxCallstackDepth variable. */
void DetermineMaxCallstackDepth()
{
//    By using this software in any fashion, you are agreeing to be bound by
//    the terms of this license.
//
//    You must not remove this notice, or any other, from this software.
// </copyright>
//
// <summary>
//    Code to configure services when the installer cannot.
// </summary>
//-------------------------------------------------------------------------------------------------

#include "precomp.h"

// prototype
SC_ACTION_TYPE GetSCActionType(__in LPCWSTR pwzActionTypeName);
HRESULT GetSCActionTypeString(__in SC_ACTION_TYPE type, __out_ecount(cchLen) LPWSTR pwzActionTypeString, __in DWORD cchLen);

// structs
LPCWSTR wzQUERY_SERVICECONFIG = L"SELECT `ServiceName`, `Component_`, `NewService`, `FirstFailureActionType`, `SecondFailureActionType`, `ThirdFailureActionType`, `ResetPeriodInDays`, `RestartServiceDelayInSeconds`, `ProgramCommandLine`, `RebootMessage` FROM `ServiceConfig`";
enum eQUERY_SERVICECONFIG { QSC_SERVICENAME = 1, QSC_COMPONENT, QSC_NEWSERVICE, QSC_FIRSTFAILUREACTIONTYPE, QSC_SECONDFAILUREACTIONTYPE, QSC_THIRDFAILUREACTIONTYPE, QSC_RESETPERIODINDAYS, QSC_RESTARTSERVICEDELAYINSECONDS, QSC_PROGRAMCOMMANDLINE, QSC_REBOOTMESSAGE };

// consts
LPCWSTR c_wzActionTypeNone = L"none";
LPCWSTR c_wzActionTypeReboot = L"reboot";
LPCWSTR c_wzActionTypeRestart = L"restart";
LPCWSTR c_wzActionTypeRunCommand = L"runCommand";

/******************************************************************
 CaSchedServiceConfig - entry point for CaSchedServiceConfig Custom Action

 called as Type 1 CustomAction (binary DLL) from Windows Installer
Exemple #12
0
// return 1 if we support GetTypeInfo
STDMETHODIMP CAMMediaContent::GetTypeInfoCount(__out UINT * pctinfo)
{
    return basedisp.GetTypeInfoCount(pctinfo);
}

// attempt to find our type library
STDMETHODIMP CAMMediaContent::GetTypeInfo(UINT itinfo, LCID lcid, __deref_out ITypeInfo ** pptinfo)
{
    return basedisp.GetTypeInfo(IID_IAMMediaContent, itinfo, lcid, pptinfo);
}

STDMETHODIMP CAMMediaContent::GetIDsOfNames(REFIID riid,
  __in_ecount(cNames) LPOLESTR * rgszNames, UINT cNames,
  LCID lcid, __out_ecount(cNames) DISPID * rgdispid)
{
    return basedisp.GetIDsOfNames(IID_IAMMediaContent, rgszNames, cNames, lcid, rgdispid);
}

STDMETHODIMP CAMMediaContent::Invoke(DISPID dispidMember, REFIID riid, LCID lcid,
  WORD wFlags, __in DISPPARAMS * pdispparams, __out_opt VARIANT * pvarResult,
  __out_opt EXCEPINFO * pexcepinfo, __out_opt UINT * puArgErr)
{
    // this parameter is a dead leftover from an earlier interface
    if (IID_NULL != riid) {	return DISP_E_UNKNOWNINTERFACE; }

    ITypeInfo * pti;
    HRESULT hr = GetTypeInfo(0, lcid, &pti);

    if (FAILED(hr)) return hr;
Exemple #13
0
//
//*****************************************************************************
#include "stdafx.h"                     // Standard header.

#if !defined(FEATURE_CORESYSTEM)

#include "delayimp.h"                   // Delay load header file.
#include "winwrap.h"                    // Wrappers for Win32 api's.
#include "utilcode.h"                   // Debug helpers.
#include "corerror.h"                   // Error codes from this EE.
#include "shimload.h"
#include "ex.h"
#include "strsafe.h"

//********** Locals. **********************************************************
static DWORD _FormatMessage(__out_ecount(chMsg) __out_z LPWSTR szMsg, DWORD chMsg, DWORD dwLastError, ...);
static void _FailLoadLib(unsigned dliNotify, DelayLoadInfo *pdli);
static void _FailGetProc(unsigned dliNotify, DelayLoadInfo *pdli);

#if defined (_DEBUG) || defined (__delay_load_trace__)
static void _DbgPreLoadLibrary(int bBreak,  DelayLoadInfo *pdli);
#endif


//********** Globals. *********************************************************

// Override __pfnDllFailureHook.  This will give the delay code a callback
// for when a load failure occurs.  This failure hook is implemented below.
FARPROC __stdcall CorDelayErrorHook(unsigned dliNotify, DelayLoadInfo *pdli);
ExternC extern PfnDliHook __pfnDliFailureHook = CorDelayErrorHook;
Exemple #14
0
WdfInstallCallback FnWdfPreDeviceInstall;
WdfInstallCallback FnWdfPostDeviceInstall;
WdfInstallCallback FnWdfPreDeviceRemove;
WdfInstallCallback FnWdfPostDeviceRemove;

#define GET_PROC(name)                                                  \
    Fn##name = (WdfInstallCallback) GetProcAddress(Library, #name);     \
    if (Fn##name == NULL) {                                             \
        Error = GetLastError();                                         \
        PrintError("GetProcAddress(\"" #name "\") failed", Error);   \
        return NULL;                                                    \
    }

LONG
GetPathToInf (
    __out_ecount(InfFilePathSize) PWCHAR InfFilePath,
    __in ULONG InfFilePathSize
    )
{
    LONG Error = ERROR_SUCCESS;

    if (GetCurrentDirectoryW(InfFilePathSize, InfFilePath) == 0) {
        PrintError("InstallDriver failed", (Error = GetLastError()));
    } else if (FAILED(StringCchCatW(InfFilePath, InfFilePathSize, INF_FILENAME))) {
        Error = ERROR_BUFFER_OVERFLOW;
    }

    return Error;
}

static
#include "adlmgr.h"
#include "xmlparser.h"
#include "nodefact.h"
#include "fstream.h"
#include "mstream.h"
#include "helpers.h"
#include "memoryreport.h"
#include "eventtrace.h"
#include "timeline.h"
#include "asmidmgr.h"
#include "hostpcymgr.h"

extern DWORD    g_dwConfigForceUnification;

HRESULT PrepQueryMatchData(IAssemblyName *pName, 
                           __out_ecount(*pdwSizeName) LPWSTR pwzAsmName,
                           __inout LPDWORD pdwSizeName,
                           __out_ecount(*pdwSizeVer) LPWSTR pwzAsmVersion, 
                           __inout LPDWORD pdwSizeVer,
                           __out_ecount(*pdwSizePKT) LPWSTR pwzPublicKeyToken, 
                           __inout LPDWORD pdwSizePKT,
                           __out_ecount_opt(pdwSizeCulture) LPWSTR pwzCulture,
                           __inout_opt LPDWORD pdwSizeCulture,
                           __out_opt PEKIND   *pe
                           )
{
    HRESULT                                     hr = S_OK;
    DWORD                                       dwSize;
    DWORD                                       dwVerHigh;
    DWORD                                       dwVerLow;
    CAssemblyName                              *pCName = NULL;
Exemple #16
0
        }
    }

    PhFree(displayToText);
    PhFree(displayToId);

    lines = PhaFormatTextTable(table, rows, columns, Mode);

    PhDeleteAutoPool(&autoPool);

    return lines;
}

VOID PhaMapDisplayIndexListView(
    __in HWND ListViewHandle,
    __out_ecount(Count) PULONG DisplayToId,
    __out_ecount_opt(Count) PPH_STRING *DisplayToText,
    __in ULONG Count,
    __out PULONG NumberOfColumns
    )
{
    LVCOLUMN lvColumn;
    ULONG i;
    ULONG count;
    WCHAR buffer[128];

    count = 0;
    lvColumn.mask = LVCF_ORDER | LVCF_TEXT;
    lvColumn.pszText = buffer;
    lvColumn.cchTextMax = sizeof(buffer) / sizeof(WCHAR);
Exemple #17
0
//
// Desc: DirectShow base classes.
//
// Copyright (c) 1992-2001 Microsoft Corporation.  All rights reserved.
//------------------------------------------------------------------------------


#include "streams.h"
#include "ddmm.h"

// Load a string from the resource file string table. The buffer must be at
// least STR_MAX_LENGTH bytes. The easiest way to use this is to declare a
// buffer in the property page class and use it for all string loading. It
// cannot be static as multiple property pages may be active simultaneously

LPTSTR WINAPI StringFromResource(__out_ecount(STR_MAX_LENGTH) LPTSTR pBuffer, int iResourceID)
{
    if (LoadString(g_hInst,iResourceID,pBuffer,STR_MAX_LENGTH) == 0) {
        return TEXT("");
    }
    return pBuffer;
}

#ifdef UNICODE
LPSTR WINAPI StringFromResource(__out_ecount(STR_MAX_LENGTH) LPSTR pBuffer, int iResourceID)
{
    if (LoadStringA(g_hInst,iResourceID,pBuffer,STR_MAX_LENGTH) == 0) {
        return "";
    }
    return pBuffer;
}
Exemple #18
0
    //
    LeaveCriticalSection(&pUsbDevice->Lock);
   
    DEBUGMSG(ZONE_TRACE,(TEXT("USBMSC<BOT_DataTransfer:%d\n"), dwErr));    

    return dwErr;
}


//
// Set a DWORD Value into an array of chars pointed to by pbArray
// (Little Endian)
//
VOID
SetDWORD(
    __out_ecount(4) PUCHAR pbArray,
    IN DWORD dwValue
    ) 
{
    if (pbArray) {
        pbArray[3] = (UCHAR)dwValue;
        dwValue >>= 8;
        pbArray[2] = (UCHAR)dwValue;
        dwValue >>= 8;
        pbArray[1] = (UCHAR)dwValue;
        dwValue >>= 8;
        pbArray[0] = (UCHAR)dwValue;
    }
    return;
}
extern "C"
void
CALLBACK
DebugExtensionUninitialize(void)
{
    return;
}

extern "C"
HRESULT
CALLBACK
KnownStructOutput(
    __in ULONG Flag,
    __in ULONG64 Address,
    __in PSTR StructName,
    __out_ecount(BufferSize) PSTR Buffer,
    __in PULONG BufferSize
    )
{
    const char* KnownStructs[] = {"_LARGE_INTEGER", "_SYSTEMTIME", NULL};
    HRESULT Hr;


    Hr = S_OK;

    if (Flag == DEBUG_KNOWN_STRUCT_GET_NAMES)
    {
        //
        // Return names of known structs in multi string
        //
        ULONG SizeRemaining = *BufferSize, SizeNeeded = 0, Length;
Exemple #20
0
#include "inet_ntop.h"

// From: https://memset.wordpress.com/2010/10/09/inet_ntop-for-win32/
PCSTR
WSAAPI
inet_ntop(__in INT Family,
          __in PVOID pAddr,
          __out_ecount(StringBufSize) PSTR pStringBuf,
          __in size_t StringBufSize) {
    DWORD dwAddressLength = 0;
    struct sockaddr_storage srcaddr;
    struct sockaddr_in *srcaddr4 = (struct sockaddr_in*) &srcaddr;
    struct sockaddr_in6 *srcaddr6 = (struct sockaddr_in6*) &srcaddr;

    memset(&srcaddr, 0, sizeof(struct sockaddr_storage));
    srcaddr.ss_family = Family;

    if (Family == AF_INET)
    {
        dwAddressLength = sizeof(struct sockaddr_in);
        memcpy(&(srcaddr4->sin_addr), pAddr, sizeof(struct in_addr));
    } else if (Family == AF_INET6)
    {
        dwAddressLength = sizeof(struct sockaddr_in6);
        memcpy(&(srcaddr6->sin6_addr), pAddr, sizeof(struct in6_addr));
    } else {
        return NULL;
    }

    if (WSAAddressToString((LPSOCKADDR) &srcaddr,
                           dwAddressLength,
Exemple #21
0
*                     trailing ':'
*       WCHAR *dir   - pointer to subdirectory component, may or may not include
*                     leading and/or trailing '/' or '\' characters
*       WCHAR *fname - pointer to file base name component
*       WCHAR *ext   - pointer to extension component, may or may not contain
*                     a leading '.'.
*
*Exit:
*       path - pointer to constructed path name
*
*Exceptions:
*
*******************************************************************************/

void MakePath (
        __out_ecount (MAX_LONGPATH) WCHAR *path,
        __in LPCWSTR drive,
        __in LPCWSTR dir,
        __in LPCWSTR fname,
        __in LPCWSTR ext
        )
{
        CONTRACTL
        {
            NOTHROW;
            GC_NOTRIGGER;
            FORBID_FAULT;
        }
        CONTRACTL_END

        const WCHAR *p;
//    Custom Actions for handling log settings for a particular IIS Website
// </summary>
//-------------------------------------------------------------------------------------------------

#include "precomp.h"

enum eWebLogQuery { wlqLog = 1, wlqFormat };

/* ****************************************************************
 * LookupLogFormatGUID -Looks up a given IIS Log format type in 
 * the metabase and returns the GUID for it.
 * ****************************************************************/
static HRESULT LookupLogFormatGUID(
    __in IMSAdminBase* piMetabase,
    __in LPCWSTR wzLogFormat,
    __out_ecount(cchGUID) LPWSTR wzGUID,
    __in int cchGUID
    )
{
    WCHAR wzKey[METADATA_MAX_NAME_LEN];
    HRESULT hr = S_OK;

    METADATA_RECORD mrKeyType;
    ::ZeroMemory(&mrKeyType, sizeof(mrKeyType));

    mrKeyType.dwMDIdentifier = MD_KEY_TYPE;
    mrKeyType.dwMDAttributes = METADATA_NO_ATTRIBUTES;
    mrKeyType.dwMDUserType = IIS_MD_UT_SERVER;
    mrKeyType.dwMDDataType = ALL_METADATA;
    mrKeyType.dwMDDataLen = 0;
    mrKeyType.pbMDData = NULL;
Exemple #23
0
        
        default:
            {
                char str[128];
                sprintf_s(str,COUNTOF(str)," [ERROR: INVALID TOKEN TYPE 0x%8.8X] ",tk);
                appendStr(out, str);
            }
    }
    return(asString(out));
}

// This function takes a module and a token and prints the representation in the mdName buffer.
void PrettyPrintClassFromToken(
    TADDR moduleAddr,                   // the module containing the token
    mdToken tok,                        // the class token to look up
    __out_ecount(cbName) WCHAR* mdName, // where to put the pretty printed string
    size_t cbName,                      // the capacity of the buffer
    DWORD formatFlags /*= FormatCSharp*/)
{
    // set the default value
    swprintf_s(mdName, cbName, L"token_0x%8.8X", tok);

    DacpModuleData dmd;
    if (dmd.Request(g_sos, TO_CDADDR(moduleAddr)) != S_OK)
        return;

    ToRelease<IMetaDataImport> pImport(MDImportForModule(&dmd));
    ToRelease<IMDInternalImport> pIMDI = NULL;

    if ((pImport == NULL) || FAILED(GetMDInternalFromImport(pImport, &pIMDI)))
        return;
    return (hr == S_OK);
}

//+---------------------------------------------------------------------------
//
// CLSIDToString
//
//----------------------------------------------------------------------------

static const BYTE GuidMap[] = {3, 2, 1, 0, '-', 5, 4, '-', 7, 6, '-',
    8, 9, '-', 10, 11, 12, 13, 14, 15};

static const char szDigits[] = "0123456789ABCDEF";
static const WCHAR wszDigits[] = L"0123456789ABCDEF";

BOOL CLSIDToStringA(REFGUID refGUID, __out_ecount(CLSID_STRLEN + 1) LPSTR pchA)
{
    int i, j;
    char *p = pchA;

    const BYTE * pBytes = (const BYTE *) &refGUID;

    j = 0;
    p[j++] = '{';
    for (i = 0; i < sizeof(GuidMap) && j < CLSID_STRLEN - 2; i++)    // CLSID_STRLEN-2 is rid { and }
    {
        if (GuidMap[i] == '-')
        {
            p[j++] = '-';
        }
        else
Exemple #25
0
fail1:
	EFSYS_PROBE1(fail1, int, rc);

	return (rc);
}


#define	SIENA_MAC_STAT_READ(_esmp, _field, _eqp)			\
	EFSYS_MEM_READQ((_esmp), (_field) * sizeof (efx_qword_t), _eqp)

	__checkReturn			int
siena_mac_stats_update(
	__in				efx_nic_t *enp,
	__in				efsys_mem_t *esmp,
	__out_ecount(EFX_MAC_NSTATS)	efsys_stat_t *stat,
	__out_opt			uint32_t *generationp)
{
	efx_qword_t rx_pkts;
	efx_qword_t value;
	efx_qword_t generation_start;
	efx_qword_t generation_end;

	_NOTE(ARGUNUSED(enp))

	/* Read END first so we don't race with the MC */
	SIENA_MAC_STAT_READ(esmp, MC_CMD_MAC_GENERATION_END,
			    &generation_end);
	EFSYS_MEM_READ_BARRIER();

	/* TX */
Exemple #26
0
    if (psw)
    {
        ScaWebsFreeList(psw);
    }

    ReleaseStr(pwzData);

    return hr;
}


HRESULT ScaWebsGetBase(
    __in IMSAdminBase* piMetabase,
    __in SCA_WEB* pswList,
    __in LPCWSTR wzWeb,
    __out_ecount(cchWebBase) LPWSTR wzWebBase,
    __in DWORD cchWebBase,
    __in WCA_WRAPQUERY_HANDLE hWrapQuery
    )
{
    HRESULT hr = S_OK;
    MSIHANDLE hRec;

    int iSiteId;
    WCHAR wzIP[MAX_PATH];
    int iPort = -1;
    WCHAR wzHeader[MAX_PATH];
    BOOL fSecure = FALSE;

    LPWSTR pwzData = NULL;
Exemple #27
0
#include "keypad_dispatcher/CCKeypadDispatcher.h"
#include "support/CCPointExtension.h"
#include "CCApplication.h"

NS_CC_BEGIN

#if(_MSC_VER >= 1600) // Visual Studio 2010 or higher version.
// Windows Touch define
#define MOUSEEVENTF_FROMTOUCH 0xFF515700

// Windows Touch functions
// Workaround to be able tu run app on Windows XP
typedef WINUSERAPI BOOL (WINAPI *RegisterTouchWindowFn)(_In_ HWND hwnd, _In_ ULONG ulFlags);
typedef WINUSERAPI BOOL (WINAPI *UnregisterTouchWindowFn)(_In_ HWND hwnd);
typedef WINUSERAPI LPARAM (WINAPI *GetMessageExtraInfoFn)(VOID);
typedef WINUSERAPI BOOL (WINAPI *GetTouchInputInfoFn)(_In_ HTOUCHINPUT hTouchInput, _In_ UINT cInputs, __out_ecount(cInputs) PTOUCHINPUT pInputs, _In_ int cbSize);
typedef WINUSERAPI BOOL (WINAPI *CloseTouchInputHandleFn)(_In_ HTOUCHINPUT hTouchInput);

static RegisterTouchWindowFn s_pfRegisterTouchWindowFunction = NULL;
static UnregisterTouchWindowFn s_pfUnregisterTouchWindowFunction = NULL;
static GetMessageExtraInfoFn s_pfGetMessageExtraInfoFunction = NULL;
static GetTouchInputInfoFn s_pfGetTouchInputInfoFunction = NULL;
static CloseTouchInputHandleFn s_pfCloseTouchInputHandleFunction = NULL;

static bool CheckTouchSupport()
{
	s_pfRegisterTouchWindowFunction = (RegisterTouchWindowFn)GetProcAddress(GetModuleHandle(TEXT("user32.dll")), "RegisterTouchWindow");
	s_pfUnregisterTouchWindowFunction = (UnregisterTouchWindowFn)GetProcAddress(GetModuleHandle(TEXT("user32.dll")), "UnregisterTouchWindow");
	s_pfGetMessageExtraInfoFunction = (GetMessageExtraInfoFn)GetProcAddress(GetModuleHandle(TEXT("user32.dll")), "GetMessageExtraInfo");
	s_pfGetTouchInputInfoFunction = (GetTouchInputInfoFn)GetProcAddress(GetModuleHandle(TEXT("user32.dll")), "GetTouchInputInfo");
	s_pfCloseTouchInputHandleFunction = (CloseTouchInputHandleFn)GetProcAddress(GetModuleHandle(TEXT("user32.dll")), "CloseTouchInputHandle");
Exemple #28
0
//
// Given a control PC, return the function entry of the function it is in.
//
// Arguments:
//    address  - the specified IP
//    pBuffer  - the buffer to store the retrieved function entry
//    cbBuffer - the size of the buffer
//
// Return Value:
//    S_OK          if we retrieve the function entry successfully;
//    E_INVALIDARG  if the buffer is too small;
//    E_FAIL        otherwise
//

HRESULT OOPStackUnwinder::GetFunctionEntry(                       DWORD64 address,
                                           __out_ecount(cbBuffer) PVOID   pBuffer,
                                                                  DWORD   cbBuffer)
{
    if (cbBuffer < sizeof(T_RUNTIME_FUNCTION))
    {
        return E_INVALIDARG;
    }

    PVOID pFuncEntry = NULL;
    GetRuntimeStackWalkInfo(address, NULL, reinterpret_cast<UINT_PTR *>(&pFuncEntry));
    if (pFuncEntry == NULL)
    {
        return E_FAIL;
    }

    memcpy(pBuffer, pFuncEntry, cbBuffer);
Exemple #29
0
)
{
    WRAPPER_NO_CONTRACT;
    CCompRC::SetDefaultCallbacks(
        fpGetThreadUICultureNames,
        fpGetThreadUICultureId
    );

}

//*****************************************************************************
// Public function to load a resource string
//*****************************************************************************
STDAPI UtilLoadStringRC(
    UINT iResourceID, 
    __out_ecount(iMax) LPWSTR szBuffer, 
    int iMax, 
    int bQuiet
)
{
    WRAPPER_NO_CONTRACT;
    return UtilLoadResourceString(bQuiet? CCompRC::Optional : CCompRC::Required,iResourceID, szBuffer, iMax);
}

HRESULT UtilLoadResourceString(CCompRC::ResourceCategory eCategory, UINT iResourceID, __out_ecount (iMax) LPWSTR szBuffer, int iMax)
{
    CONTRACTL
    {
        DISABLED(NOTHROW);
        GC_NOTRIGGER;
    }
Exemple #30
0
#include "resource.h"
#include "cmnutils.h"
#include "encrypt.h"

const TCHAR c_szHelpApp[] = TEXT("peghelp");
const TCHAR c_szLogonNoPasswordHelpLink[] =
        TEXT("file:connect.htm#logonnopassword");
const TCHAR c_szLogonPasswordHelpLink[] =
        TEXT("file:connect.htm#logonpassword");

// split a string of the form domain\user into domain and user components
// if string is of the form user then domain is set to blank
// on input cchDomain and cchUser contain buffer sizes

static HRESULT SplitDomainUser(__in LPCTSTR pszSource,
                               __out_ecount(cchDomain) LPTSTR pszDomain, UINT cchDomain,
                               __out_ecount(cchUser) LPTSTR pszUser, UINT cchUser)
{
    HRESULT hr = S_OK;
    LPCTSTR pszSep;
    LPTSTR  pszUserEnd;

    // Is there a separator?
    pszSep = _tcschr(pszSource, TEXT('\\'));
    if (NULL != pszSep)
    {
        // Copy the domain portion
        hr = StringCchCopyN(pszDomain, cchDomain, pszSource, pszSep - pszSource);
        CHR(hr);

        // Copy the user portion