Ejemplo n.º 1
0
tERROR KLE_CALL KLEScanFile ( KLE_SCAN_OBJECT* so, tVOID* filename, tBOOL bUnicode)
{
	if(!so) 
		return KLE_ERR_BAD_PARAMETER;
	if(filename)
		KLESetPropString( so, KLE_PROP_OBJECT_NAME_STRING, filename, bUnicode);
	if(!so->ObjectName)
		return KLE_ERR_BAD_PARAMETER;
	AVPScanObject* avpso=(AVPScanObject*)(so->RefData);

#ifdef NT_DRIVER
	KUstring uName(0x200,NonPagedPool);
	uName.Assign(*(so->ObjectName));
	if(*(((PUNICODE_STRING)uName)->Buffer +1) == ':'){
		uName.Assign(LNT_ROOT_PREFIX);
		uName.Append(*(so->ObjectName));
	}
	avpso->NativeName=(DWORD)((PUNICODE_STRING)uName)->Buffer;
	if(!NT_SUCCESS(uName.ToPsz(avpso->Name,0x200))){
		strcpy(avpso->Name,"Object with bad name");
	}
#else
	strcpy(avpso->Name,so->ObjectName);
#endif
	avpso->MFlags=MFLAGS;
	
	return ScanObjectSync(avpso);
}
bool
HippoAbstractWindow::registerClass()
{
    WNDCLASSEX wcex;
    
    // note that the class may be a predefined Windows control class,
    // and that RegisterClassEx does NOT fail if the class is already
    // registered

    HippoUStr uName(className_);
    if (GetClassInfoEx(instance_, className_.m_str, &wcex) != 0) {
        g_debug("Got existing window class %s", uName.c_str());
        return true;
    } else if (GetClassInfoEx(NULL, className_.m_str, &wcex) != 0) {
        g_debug("Got existing system window class %s", uName.c_str());
        return true;
    } else {
        ZeroMemory(&wcex, sizeof(WNDCLASSEX));
        wcex.cbSize = sizeof(WNDCLASSEX); 

        wcex.style = classStyle_;
        wcex.lpfnWndProc = windowProc;
        wcex.cbClsExtra = 0;
        wcex.cbWndExtra = 0;
        wcex.hInstance  = instance_;
        wcex.hCursor    = LoadCursor(NULL, IDC_ARROW);
        wcex.hbrBackground  = (HBRUSH)(COLOR_WINDOW+1);
        wcex.lpszMenuName   = NULL;
        wcex.lpszClassName  = className_.m_str;
        if (ui_) {
            wcex.hIcon = ui_->getBigIcon();
            wcex.hIconSm = ui_->getSmallIcon();;
        }

        if (RegisterClassEx(&wcex) == 0) {
            HippoBSTR err;
            hippoHresultToString(GetLastError(), err);
            g_warning("Failed to register window class and failed to get existing class %s: %s", uName.c_str(),
                HippoUStr(err).c_str());
            return false;
        } else {
            g_debug("Registered new window class %s", uName.c_str());
            return true;
        }
    }
}