void FOnlineAsyncTaskGooglePlayLogin::Start_OnTaskThread()
{
	// If we haven't created a GameServices object yet, do so.
	if (Subsystem->GameServicesPtr.get() == nullptr)
	{
		// Store the Subsystem pointer locally so that the OnAuthActionFinished lambda can capture it
		FOnlineSubsystemGooglePlay* LocalSubsystem = Subsystem;

		Subsystem->GameServicesPtr = GameServices::Builder()
			.SetDefaultOnLog(LogLevel::VERBOSE)
			.SetOnAuthActionStarted([](AuthOperation Op) {
				UE_LOG(LogOnline, Log, TEXT("GPG OnAuthActionStarted: %s"), *FString(DebugString(Op).c_str()));
			})
			.SetOnAuthActionFinished([LocalSubsystem](AuthOperation Op, AuthStatus LocalStatus) {
				UE_LOG(LogOnline, Log, TEXT("GPG OnAuthActionFinished: %s, AuthStatus: %s"),
					*FString(DebugString(Op).c_str()),
					*FString(DebugString(LocalStatus).c_str()));
				LocalSubsystem->OnAuthActionFinished(Op, LocalStatus);
			})
			.Create(Subsystem->PlatformConfiguration);
	}
	else if(Subsystem->GameServicesPtr->IsAuthorized())
	{
		// We have a GameServices object and the user is authorized, nothing else to do.
		Status = AuthStatus::VALID;
		bWasSuccessful = true;
		bIsComplete = true;
	}
	else
	{
		// We have created the GameServices object but the user isn't authorized.
		bWasSuccessful = false;
		bIsComplete = true;
	}
}
Exemplo n.º 2
0
Arquivo: cp.c Projeto: laohyx/nachos
int main(int argc, char **argv)
{
  OpenFileId src, dest;
  int num_read;
  char buffer;
  
  Create(argv[2]);
  
  src = Open(argv[1],RO);
  dest = Open(argv[2],RW);
  DebugString(argv[0],0);
  DebugString(argv[1],0);
  DebugString(argv[2],0);
  if ((src<0) || (dest<0))
    Exit(-1);
  
  do
  {
    num_read = Read(src, &buffer, 1);

    if (num_read > 0)
      Write(dest, &buffer, 1);
  }while (num_read > 0);
  
  Close(src);
  Close(dest);
}
Exemplo n.º 3
0
waContainer::waContainer(const char *filename) : wacLib(filename), wacomp(NULL) {
	//load our wac file
	wacLib.load();

	//gather our wac functions
  initProc = (WACINIT)wacLib.getProcAddress("WAC_init");
  getWacProc = (WACGETCOMPONENT)wacLib.getProcAddress("WAC_getWaComponent");
  versionProc = (WACGETVERSION)wacLib.getProcAddress("WAC_getVersion");
	
  if(initProc == NULL || getWacProc == NULL || versionProc == NULL) {
    DebugString("WAC Failed To Load (invalid WAC):\n%s\n",filename);
    return;
  }

	//check the wac version against the version suported by the exe
  if(versionProc() == WA_COMPONENT_VERSION) {
    //init the wac
    initProc(wacLib.getHandle());

    wacomp = getWacProc();

    //if something goes bad and we dont get a wacomponent.
    if(!wacomp) {
      DebugString("WAC_getWaComponent Failed:\n%s\n",filename);
      return;
		}

		//all is good, register the api
    wacomp->registerServices(WASABI_API_SVC);

	} else {
		//yep, we're boned.. this wac is old :)
    DebugString("WAC Failed To Load (version out of date):\n%s\n",filename);
	}
}
Exemplo n.º 4
0
FreelistPriv::~FreelistPriv() {
#ifdef ASSERTS_ENABLED
//  ASSERTPR(total_allocated == 0, "didn't free entire freelist!(1)");
//  ASSERTPR(blocks.getNumItems() == 0, "didn't free entire freelist!(2)");
  if (total_allocated != 0) DebugString("didn't free entire freelist!(1)\n");
  if (blocks.getNumItems() != 0) DebugString("didn't free entire freelist!(2)\n");
#endif
}
Exemplo n.º 5
0
LRESULT CALLBACK GuiClientRetHook(int nCode, WPARAM wParam, LPARAM lParam)
{
	if (nCode == HC_ACTION)
	{
		CWPRETSTRUCT* p = (CWPRETSTRUCT*)lParam;
		CREATESTRUCT* pc = NULL;
		wchar_t szDbg[200]; szDbg[0] = 0;
		wchar_t szClass[127]; szClass[0] = 0;
		switch (p->message)
		{
			case WM_DESTROY:
			{
				user->getClassNameW(p->hwnd, szClass, countof(szClass));
				msprintf(szDbg, countof(szDbg), L"WM_DESTROY on 0x%08X (%s)\n", (DWORD)p->hwnd, szClass);
				break;
			}
			case WM_CREATE:
			{
				pc = (CREATESTRUCT*)p->lParam;
				if (p->lResult == -1)
				{
					wcscpy_c(szDbg, L"WM_CREATE --FAILED--\n");
				}
				break;
			}
			case WM_SIZE:
			case WM_MOVE:
			case WM_WINDOWPOSCHANGED:
			case WM_WINDOWPOSCHANGING:
			{
				WINDOWPOS *wp = (WINDOWPOS*)p->lParam;
				WORD x = LOWORD(p->lParam);
				WORD y = HIWORD(p->lParam);
				if (p->hwnd == ghAttachGuiClient || p->hwnd == hMonitorWndPos)
				{
					int nDbg = 0;
					if (p->message == WM_WINDOWPOSCHANGING || p->message == WM_WINDOWPOSCHANGED)
					{
						if ((wp->x > 0 || wp->y > 0) && !isPressed(VK_LBUTTON))
						{
							if (user->getParent(p->hwnd) == ghConEmuWndBack)
							{
								//_ASSERTEX(!(wp->x > 0 || wp->y > 0));
								break;
							}
						}
					}
				}
				break;
			}
		}

		if (*szDbg)
		{
			DebugString(szDbg);
		}
	}

	return user->callNextHookEx(ghGuiClientRetHook, nCode, wParam, lParam);
}
Exemplo n.º 6
0
void VideoOutputNullVDPAU::CheckFrameStates(void)
{
    QMutexLocker locker(&m_lock);
    frame_queue_t::iterator it;
    it = vbuffers.begin_lock(kVideoBuffer_displayed);
    while (it != vbuffers.end(kVideoBuffer_displayed))
    {
        VideoFrame* frame = *it;
        if (vbuffers.Contains(kVideoBuffer_decode, frame))
        {
            LOG(VB_PLAYBACK, LOG_INFO, LOC +
                QString("Frame %1 is in use by avlib and so is "
                        "being held for later discarding.")
                        .arg(DebugString(frame, true)));
        }
        else
        {
            vbuffers.SafeEnqueue(kVideoBuffer_avail, frame);
            vbuffers.end_lock();
            it = vbuffers.begin_lock(kVideoBuffer_displayed);
            continue;
        }
        ++it;
    }
    vbuffers.end_lock();
}
Exemplo n.º 7
0
SQLRETURN SRVR_STMT_HDL::Execute(const char *inCursorName, long totalRowCount, short inSqlStmtType,
								 const SQLValueList_def *inValueList,
								 short inSqlAsyncEnable, long inQueryTimeout,
								 SQLValueList_def *outValueList)
{
	FUNCTION_ENTRY("SRVR_STMT_HDL::Execute",(""));
	DEBUG_OUT(DEBUG_LEVEL_ENTRY,("  inCursorName=%s, totalRowCount=%ld, inSqlStmtType=%s",
		DebugString(inCursorName),
		totalRowCount,
		CliDebugSqlStatementType(inSqlStmtType)));
	DEBUG_OUT(DEBUG_LEVEL_ENTRY,("  inValueList=0x%08x",
		inValueList));
	DEBUG_OUT(DEBUG_LEVEL_ENTRY,("  inSqlAsyncEnable=%d, inQueryTimeout=%ld",
		inSqlAsyncEnable,
		inQueryTimeout));
	DEBUG_OUT(DEBUG_LEVEL_ENTRY,("  outValueList=0x%08x",
		outValueList));
	SQLRETURN rc;
	char *saveptr=NULL;
	SRVR_CONNECT_HDL *pConnect = NULL;

	if (dialogueId == 0) CLI_DEBUG_RETURN_SQL(SQL_ERROR);
	pConnect = (SRVR_CONNECT_HDL *)dialogueId;
				
	cleanupSQLMessage();
	if (rowCount._buffer == NULL || batchRowsetSize > inputRowCnt)
	{
	   inputRowCnt = batchRowsetSize;
           if (inputRowCnt == 0)
              inputRowCnt = 1;
           if (rowCount._buffer != NULL)
              MEMORY_DELETE(rowCount._buffer);
	   MEMORY_ALLOC_ARRAY(rowCount._buffer,int, inputRowCnt);
	   rowCount._length = 0;
        }
Exemplo n.º 8
0
// Sets the attributes of characters written to the console screen buffer by
// the WriteFile or WriteConsole function, or echoed by the ReadFile or ReadConsole function.
// This function affects text written after the function call.
BOOL WINAPI OnSetConsoleTextAttribute(HANDLE hConsoleOutput, WORD wAttributes)
{
	//typedef BOOL (WINAPI* OnSetConsoleTextAttribute_t)(HANDLE hConsoleOutput, WORD wAttributes);
	ORIGINAL_KRNL(SetConsoleTextAttribute);

	BOOL lbRc = FALSE;

	if (ph && ph->PreCallBack)
	{
		SETARGS2(&lbRc, hConsoleOutput, wAttributes);
		ph->PreCallBack(&args);
	}

	#ifdef _DEBUG
	// We do not care if visible ChildGui is doing smth in their console
	// Process here only our native console windows
	if ((ghAttachGuiClient == NULL) && !gbAttachGuiClient && (wAttributes != 7))
	{
		wchar_t szDbgInfo[128];
		msprintf(szDbgInfo, countof(szDbgInfo), L"PID=%u, SetConsoleTextAttribute=0x%02X(%u)\n", GetCurrentProcessId(), (int)wAttributes, (int)wAttributes);
		DebugString(szDbgInfo);
	}
	#endif

	lbRc = F(SetConsoleTextAttribute)(hConsoleOutput, wAttributes);

	if (ph && ph->PostCallBack)
	{
		SETARGS2(&lbRc, hConsoleOutput, wAttributes);
		ph->PostCallBack(&args);
	}

	return lbRc;
}
Exemplo n.º 9
0
HANDLE WINAPI OnCreateNamedPipeW(LPCWSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances,DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut,LPSECURITY_ATTRIBUTES lpSecurityAttributes)
{
	//typedef HANDLE(WINAPI* OnCreateNamedPipeW_t)(LPCWSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances,DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut,LPSECURITY_ATTRIBUTES lpSecurityAttributes);
	ORIGINAL_KRNL(CreateNamedPipeW);

	#ifdef _DEBUG
	if (!lpName || !*lpName)
	{
		_ASSERTE(lpName && *lpName);
	}
	else
	{
		int nLen = lstrlen(lpName)+64;
		wchar_t* psz = (wchar_t*)malloc(nLen*sizeof(*psz));
		if (psz)
		{
			msprintf(psz, nLen, L"CreateNamedPipeW(%s)\n", lpName);
			DebugString(psz);
			free(psz);
		}
	}
	#endif

	HANDLE hPipe = F(CreateNamedPipeW)(lpName, dwOpenMode, dwPipeMode, nMaxInstances, nOutBufferSize, nInBufferSize, nDefaultTimeOut, lpSecurityAttributes);
	return hPipe;
} // OnCreateNamedPipeW
Exemplo n.º 10
0
void GLWnd::glMakeCurrent() {
  if (!m_rendercontext) {
    DebugString("Trying to make GLWnd context current, but it is invalid, further code may act upon wrong context");
    return;
  }
  wglMakeCurrent(m_dc, m_rendercontext);
}
Exemplo n.º 11
0
void MSectionLock::Unlock()
{
	if (mp_S && mb_Locked)
	{
		#ifdef _DEBUG
		DWORD nCurTID = GetCurrentThreadId();
		wchar_t szDbg[80];
		if (mb_Exclusive)
			msprintf(szDbg, countof(szDbg), L"::Unlock(), TID=%u\n", nCurTID);
		else
			szDbg[0] = 0;
		#endif

		_ASSERTEX(mb_Exclusive || mp_S->mn_Locked>0);
		mp_S->Unlock(mb_Exclusive);
		mb_Locked = FALSE;

		#ifdef _DEBUG
		if (*szDbg)
		{
			DebugString(szDbg);
		}
		#endif
	}
}
Exemplo n.º 12
0
std::string DebugString(Quantity<D> const& quantity, int const precision) {
  return DebugString(quantity.magnitude_, precision) +
      FormatUnit("m", D::Length) + FormatUnit("kg", D::Mass) +
      FormatUnit("s", D::Time) + FormatUnit("A", D::Current) +
      FormatUnit("K", D::Temperature) + FormatUnit("mol", D::Amount) +
      FormatUnit("cd", D::LuminousIntensity) + FormatUnit("cycle", D::Winding) +
      FormatUnit("rad", D::Angle) + FormatUnit("sr", D::SolidAngle);
}
Exemplo n.º 13
0
    //--------------------------------------------------------------
    void draw() {
        stringstream message;

        if(session) {
            // inputs are linked to mouse position, normalized to 0..10
            float a = round(ofMap(ofGetMouseX(), 0, ofGetWidth(), 0, 10));
            float b = round(ofMap(ofGetMouseY(), 0, ofGetHeight(), 0, 10));

            // convert to tensors
            auto t_a = msa::tf::scalar_to_tensor(a);
            auto t_b = msa::tf::scalar_to_tensor(b);

            // output tensors will be stored in this
            vector<tensorflow::Tensor> outputs;

            // Run the graph, pass in
            // inputs to feed: array of dicts of { node name : tensor } )
            // outputs to fetch: array of node names
            // evaluates operation and return tensors in last parameter
            // The strings must match the name of the variable/node in the graph
            session->Run({ { "a", t_a }, { "b", t_b } }, { "c" }, {}, &outputs);

            // outputs is a vector of tensors, in our case we fetched only one tensor
            auto t_c = outputs[0];

            // get scalar value of tensor
            float c = msa::tf::tensor_to_scalar<float>(t_c);

            // Print the results
            message << "MOVE MOUSE!" << endl << endl;
            message << a << " (" << t_a.DebugString() << ")" << endl;
            message << " * " << endl;
            message << b << " (" << t_b.DebugString() << ")" << endl;
            message << " = " << endl;
            message << c << " (" << t_c.DebugString() << ")" << endl;
            message << endl;
            message << "all this madness, just to calculate a * b" << endl;

        } else {
            message << "Error during initialization, check console for details.";

        }

        ofDrawBitmapString(message.str(), 30, 30);
    }
Exemplo n.º 14
0
void FUDebug::DebugOutV(uint8 verbosity, const char* filename, uint32 line, const char* message, va_list& vars)
{
	char buffer[256];
	snprintf(buffer, 256, "[%s@%du] ", filename, line);
	buffer[255] = 0;
	DebugString(buffer);

	FUDebug::DebugOutV(verbosity, message, vars);
}
Exemplo n.º 15
0
static GLuint BuildProgram(const char* vsKey, const char* fsKey)
{
    DebugString("Compiling '%s'...\n", vsKey);
    const char* vsString = glswGetShader(vsKey);
    if (!vsString)
    {
        FatalError("%s\n", glswGetError());
    }
    GLuint vsHandle = BuildShader(vsString, GL_VERTEX_SHADER);

    DebugString("Compiling '%s'...\n", fsKey);
    const char* fsString = glswGetShader(fsKey);
    if (!fsString)
    {
        FatalError("%s\n", glswGetError());
    }
    GLuint fsHandle = BuildShader(fsString, GL_FRAGMENT_SHADER);

    DebugString("Linking...\n");
    GLuint programHandle = glCreateProgram();
    glAttachShader(programHandle, vsHandle);
    glAttachShader(programHandle, fsHandle);
    glBindAttribLocation(programHandle, VertexAttributes::Position, "Position");
    glBindAttribLocation(programHandle, VertexAttributes::Normal, "Normal");
    glLinkProgram(programHandle);

    GLint linkSuccess;
    glGetProgramiv(programHandle, GL_LINK_STATUS, &linkSuccess);
    if (linkSuccess == GL_FALSE)
    {
        GLchar messages[256];
        glGetProgramInfoLog(programHandle, sizeof(messages), 0, &messages[0]);
        FatalError(messages);
    }
    else
    {
        GLchar messages[256];
        glGetProgramInfoLog(programHandle, sizeof(messages), 0, &messages[0]);
        DebugString(messages);
    }

    return programHandle;
}
Exemplo n.º 16
0
void XUIObject::destroyChild(XUIObject *child) {
  int pos = m_children.searchItem(child);
  if (pos < 0) return;
  m_children.removeByPos(pos);
  svc_xuiObject *svc = child->getOwnerService();
  if (svc == NULL) {
    DebugString("Owner service is NULL for XUIObject %s", getTagName());
  } else {
    svc->destroy(child);
  }
  reflow();
}
Exemplo n.º 17
0
std::string ToMathematica(Quantity<D> const& quantity) {
  std::string s = DebugString(quantity);
  if (IsFinite(quantity)) {
    s.replace(s.find("e"), 1, "*^");
  }
  std::string const number = ToMathematica(quantity / SIUnit<Quantity<D>>());
  std::size_t const split = s.find(" ");
  std::string const units = Escape(s.substr(split, s.size()));
  return Apply(
      "SetPrecision",
      {Apply("Quantity", {number, units}), "MachinePrecision"});
}
Exemplo n.º 18
0
const cfg::Module *ReadCFG(std::string cfg_file_name) {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  std::ifstream cfg(cfg_file_name);
  CHECK(cfg.good()) << "Invalid CFG file: " << cfg_file_name;

  auto cfg_pb = new cfg::Module;
  auto parsed = cfg_pb->ParseFromIstream(&cfg);
  CHECK(parsed)
      << "Unable to parse CFG file: " << cfg_file_name
      << " with error " << cfg_pb->DebugString();

  return cfg_pb;
}
Exemplo n.º 19
0
int TextFeed::sendFeed(const char *feedid, const char *text) {
  Pair <String, String> ft("","");
  if (!feeds.getItem(String(feedid), &ft)) {
//CUT    ASSERTALWAYS("hey, you're trying to send a feed you didn't register. stop it.");
    DebugString("TextFeed::sendFeed(), feedid '%s' not registered", feedid);
    return FALSE;
  }
  String id(feedid);
  feeds.getItem(id, &ft);
  ft.a = String(text);
  feeds.setItem(String(feedid), ft);
  dependent_sendEvent(svc_textFeed::depend_getClassGuid(), Event_TEXTCHANGE, (int)feedid, (void*)text, STRLEN(text)+1);
  return TRUE;
}
Exemplo n.º 20
0
BOOL WINAPI OnFlushConsoleInputBuffer(HANDLE hConsoleInput)
{
	//typedef BOOL (WINAPI* OnFlushConsoleInputBuffer_t)(HANDLE hConsoleInput);
	SUPPRESSORIGINALSHOWCALL;
	ORIGINAL_KRNL(FlushConsoleInputBuffer);
	BOOL lbRc = FALSE;

	//_ASSERTEX(FALSE && "calling FlushConsoleInputBuffer");
	DebugString(L"### calling FlushConsoleInputBuffer\n");

	lbRc = F(FlushConsoleInputBuffer)(hConsoleInput);

	return lbRc;
}
Exemplo n.º 21
0
inline std::string ToMathematica(double const& real) {
  if (std::isinf(real)) {
    if (real > 0.0) {
      return "Infinity";
    } else {
      return Apply("Minus", {"Infinity"});
    }
  } else if (std::isnan(real)) {
    return "Indeterminate";
  } else {
    std::string s = DebugString(real);
    s.replace(s.find("e"), 1, "*^");
    return Apply("SetPrecision", {s, "MachinePrecision"});
  }
}
Exemplo n.º 22
0
void XUIObject::destroyChildren(PtrList<XUIObject> *deletelist) {
  foreach(*deletelist)
    XUIObject *child = deletelist->getfor();
    int pos = m_children.searchItem(child);
    if (pos < 0) return;
    m_children.removeByPos(pos);
    svc_xuiObject *svc = child->getOwnerService();
    if (svc == NULL) {
      DebugString("Owner service is NULL for XUIObject %s", getTagName());
    } else {
      svc->destroy(child);
    }
  endfor;
  reflow();
}
Exemplo n.º 23
0
void FUDebug::DebugOutV(uint8 verbosity, const char* message, va_list& vars)
{
	uint32 length = (uint32) strlen(message);
	char* buffer = new char[length + 256];
	vsnprintf(buffer, length + 256, message, vars);
	length = (uint32) min(strlen(buffer), (size_t) length + 253);
	buffer[length] = '\n';
	buffer[length+1] = '\r';
	buffer[length+2] = 0;

	DebugString(buffer);
	FUError::SetCustomErrorString(buffer);
	FUError::Error((FUError::Level) verbosity, FUError::ERROR_CUSTOM_STRING, 5000);

	SAFE_DELETE_ARRAY(buffer);
}
Exemplo n.º 24
0
BOOL WINAPI OnCreateProcessA(LPCSTR lpApplicationName,  LPSTR lpCommandLine,  LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory,  LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
{
	//typedef BOOL (WINAPI* OnCreateProcessA_t)(LPCSTR lpApplicationName,  LPSTR lpCommandLine,  LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory,  LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation);
	ORIGINAL_KRNL(CreateProcessA);
	BOOL lbRc = FALSE;
	DWORD dwErr = 0;


	if (ph && ph->PreCallBack)
	{
		SETARGS10(&lbRc, lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation);

		// Если функция возвращает FALSE - реальное чтение не будет вызвано
		if (!ph->PreCallBack(&args))
			return lbRc;
	}

	CShellProc* sp = new CShellProc();
	if (!sp || !sp->OnCreateProcessA(&lpApplicationName, (LPCSTR*)&lpCommandLine, &lpCurrentDirectory, &dwCreationFlags, lpStartupInfo))
	{
		delete sp;
		SetLastError(ERROR_FILE_NOT_FOUND);
		return FALSE;
	}
	if ((dwCreationFlags & CREATE_SUSPENDED) == 0)
	{
		DebugString(L"CreateProcessA without CREATE_SUSPENDED Flag!\n");
	}

	lbRc = F(CreateProcessA)(lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation);
	dwErr = GetLastError();


	// Если lbParamsChanged == TRUE - об инжектах позаботится ConEmuC.exe
	sp->OnCreateProcessFinished(lbRc, lpProcessInformation);
	delete sp;


	if (ph && ph->PostCallBack)
	{
		SETARGS10(&lbRc, lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation);
		ph->PostCallBack(&args);
	}

	SetLastError(dwErr);
	return lbRc;
}
Exemplo n.º 25
0
MSectionLock::~MSectionLock()
{
	_ASSERTEX((mb_Locked==FALSE || mb_Locked==TRUE) && (mb_Exclusive==FALSE || mb_Exclusive==TRUE));
	if (mb_Locked)
	{
		DWORD nCurTID = GetCurrentThreadId();

		Unlock();

		#ifdef _DEBUG
		wchar_t szDbg[80];
		msprintf(szDbg, countof(szDbg), L"::~MSectionLock, TID=%u\n", nCurTID);
		DebugString(szDbg);
		#endif
		UNREFERENCED_PARAMETER(nCurTID);
	}
}
Exemplo n.º 26
0
HANDLE WINAPI OnCreateFileW(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
{
	//typedef HANDLE (WINAPI* OnCreateFileW_t)(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
	ORIGINAL_KRNL(CreateFileW);
	HANDLE h;

	HandleKeeper::PreCreateHandle(hs_CreateFileW, dwDesiredAccess, dwShareMode, (const void**)&lpFileName);

	h = F(CreateFileW)(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
	DWORD nLastErr = GetLastError();

	DebugString(L"OnCreateFileW executed\n");

	HandleKeeper::AllocHandleInfo(h, hs_CreateFileW, dwDesiredAccess, lpFileName);

	SetLastError(nLastErr);
	return h;
}
Exemplo n.º 27
0
BOOL WINAPI OnTrackPopupMenuEx(HMENU hmenu, UINT fuFlags, int x, int y, HWND hWnd, LPTPMPARAMS lptpm)
{
	//typedef BOOL (WINAPI* OnTrackPopupMenuEx_t)(HMENU hmenu, UINT fuFlags, int x, int y, HWND hWnd, LPTPMPARAMS lptpm);
	ORIGINAL_EX(TrackPopupMenuEx);

	#if defined(_DEBUG)
	wchar_t szMsg[128]; msprintf(szMsg, countof(szMsg), L"TrackPopupMenuEx(hwnd=0x%08X)\n", LODWORD(hWnd));
	DebugString(szMsg);
	#endif

	// Far's EMenu popup fix
	FixPopupMenuHWnd(hWnd, x, y);

	BOOL lbRc = FALSE;
	if (F(TrackPopupMenuEx) != NULL)
		lbRc = F(TrackPopupMenuEx)(hmenu, fuFlags, x, y, hWnd, lptpm);
	return lbRc;
}
Exemplo n.º 28
0
LPTOP_LEVEL_EXCEPTION_FILTER WINAPI OnSetUnhandledExceptionFilter(LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter)
{
	//typedef LPTOP_LEVEL_EXCEPTION_FILTER(WINAPI* OnSetUnhandledExceptionFilter_t)(LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter);
	ORIGINAL_KRNL(SetUnhandledExceptionFilter);

	LPTOP_LEVEL_EXCEPTION_FILTER lpRc = F(SetUnhandledExceptionFilter)(lpTopLevelExceptionFilter);

	#ifdef _DEBUG
	DWORD dwErr = GetLastError();
	wchar_t szDbgInfo[100];
	msprintf(szDbgInfo, countof(szDbgInfo),
		L"SetUnhandledExceptionFilter(" WIN3264TEST(L"0x%08X",L"0x%08X%08X") L")=" WIN3264TEST(L"0x%08X",L"0x%08X%08X") L", code=%u\n",
		WIN3264WSPRINT(lpTopLevelExceptionFilter), WIN3264WSPRINT(lpRc), dwErr);
	DebugString(szDbgInfo);
	SetLastError(dwErr);
	#endif

	return lpRc;
}
Exemplo n.º 29
0
SMD_QUERY_TABLE *getSmdSelectTable (SMD_QUERY_TABLE *queryTable, const char *stmtLabel, short *sqlStmtType)
{
	FUNCTION_ENTRY("getSmdSelectTable",("queryTable=%08x, stmtLabel=%s, sqlStmtType=0x%08x",
		queryTable,
		DebugString(stmtLabel),
		sqlStmtType));
	short i;

	for (i = 0; ; i++)
	{
		if (queryTable[i].stmtLabel == NULL)
			break;
		if (strcmp(queryTable[i].stmtLabel, stmtLabel) == 0)
		{
			*sqlStmtType = queryTable[i].sqlStmtType;
			FUNCTION_RETURN_PTR(&(queryTable[i]),("queryTable[%d]",i));
		}
	}
	FUNCTION_RETURN_PTR(NULL,(NULL));
} 
Exemplo n.º 30
0
BOOL WINAPI OnVirtualProtect(LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect)
{
	//typedef BOOL(WINAPI* OnVirtualProtect_t)(LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect);
	ORIGINAL_KRNL(VirtualProtect);
	BOOL bResult = FALSE;

	if (F(VirtualProtect))
		bResult = F(VirtualProtect)(lpAddress, dwSize, flNewProtect, lpflOldProtect);

	#ifdef _DEBUG
	DWORD dwErr = GetLastError();
	wchar_t szDbgInfo[100];
	msprintf(szDbgInfo, countof(szDbgInfo),
		L"VirtualProtect(" WIN3264TEST(L"0x%08X",L"0x%08X%08X") L"," WIN3264TEST(L"0x%08X",L"0x%08X%08X") L",%u,%u)=%u, code=%u\n",
		WIN3264WSPRINT(lpAddress), WIN3264WSPRINT(dwSize), flNewProtect, lpflOldProtect ? *lpflOldProtect : 0, bResult, dwErr);
	DebugString(szDbgInfo);
	SetLastError(dwErr);
	#endif

	return bResult;
}