//读取键值对中的键值
int ReadValue(int start, LPWSTR *valueString)         //start指向属性的第一个字符
{
	List value = InitList();
	int cursor = start;
	if (PDFInByte[cursor] == 254 && PDFInByte[cursor + 1] == 255)       //BigEndianUnicode的情况
	{
		cursor += 2;
		while (PDFInByte[cursor] != 41)//读到)结束 
		{
			if (PDFInByte[cursor] == 92) cursor++;             //PDF文件逢92要跳过一次
			AddNode(value,(void*)PDFInByte[cursor++]);
			if (PDFInByte[cursor] == 92) cursor++;
			AddNode(value,(void*)PDFInByte[cursor++]);
		}
		AddNode(value,0);//Unicode 补一个0,再加上CharListGetString中补的0,构成结束符
		*valueString=UnicodeByteReverse((LPWSTR)CharListGetString(value));
	}
	else//ASCII的情况
	{
		while (PDFInByte[cursor] != 41)//读到)结束 
		{
			if (PDFInByte[cursor] == 92) cursor++;      //需要转义的情况,跳一位
			AddNode(value,(void*)PDFInByte[cursor++]);
		}
		*valueString=MByteToWChar(CharListGetString(value));
	}
	return cursor;          //cursor最后指向)
}
Пример #2
0
LONG WINAPI myImmGetCompositionStringW(HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen)
{
	LONG myReturn=0;
	LONG tempLen=0;
	int StrBufLen=0;
	if (dwIndex==GCS_RESULTSTR && g_HOOKflag)
	{
		memset(g_IMEString,0,256);
		tempLen=254;
		g_myHOOK2.HookStatus(false);
		ImmGetCompositionStringW(hIMC,GCS_RESULTSTR,g_IMEString,tempLen);
		g_myHOOK2.HookStatus(true);
		g_IMEString[254]=0;
		g_IMEString[255]=0;
		if (lstrcmpW((wchar_t *)g_IMEString,(wchar_t *)g_StringBuf1)!=0)
		{
			memset(g_StringBuf1,0,256);
			lstrcpyW((wchar_t *)g_StringBuf1,(wchar_t *)g_IMEString);
			WCharToMByte((wchar_t *)g_StringBuf1,g_IMEString,256);
			SendMessage(g_hMainhWnd,WM_HXWDLLWX_QQBTX,0,0);
			memset(g_StringBuf2,0,256);
			MByteToWChar(g_IMEString,(wchar_t *)g_StringBuf2,128);
		}
		if (lpBuf==NULL || dwBufLen==0)
		{
			myReturn=lstrlenW((wchar_t *)g_StringBuf2)*2;
		}
		else
		{
			StrBufLen=lstrlenW((wchar_t *)g_StringBuf2)*2;
			memset(lpBuf,0,dwBufLen);
			if (dwBufLen>=StrBufLen) 
			{
				dwBufLen=StrBufLen;
				myReturn=StrBufLen;
			}
			else
			{
				myReturn=0;
			}
			memcpy(lpBuf,g_StringBuf2,dwBufLen);
		}
	}
	else
	{
		g_myHOOK2.HookStatus(false);
		myReturn=ImmGetCompositionStringW(hIMC,dwIndex,lpBuf,dwBufLen);
		g_myHOOK2.HookStatus(true);
	}
	return myReturn;
}
Пример #3
0
void _TRACE(char* szFormat, ...)
{
#ifdef _DEBUG
	int iInterval = 0;
	static SYSTEMTIME	lastSystemtime;
	static int iInitSystemtime = 0x00;
	if (iInitSystemtime == 0x00)
	{
		GetSystemTime(&lastSystemtime);
		iInitSystemtime = 0x01;
	}
	else
	{
		SYSTEMTIME	systemTime;
		//GetSystemTime(&systemTime);
		GetLocalTime(&systemTime);

		if (systemTime.wSecond == lastSystemtime.wSecond)
		{
			iInterval = systemTime.wMilliseconds - lastSystemtime.wMilliseconds;
		}
		else
		{
			iInterval = 1000-lastSystemtime.wMilliseconds+systemTime.wMilliseconds;
		}
		//GetSystemTime(&lastSystemtime);
		GetLocalTime(&lastSystemtime);
	}

	SYSTEMTIME	systemTime;
	//GetSystemTime(&systemTime);
	GetLocalTime(&systemTime);
	_TRACE_W(TEXT("%u:%u:%u.%03d[%d]\t"), systemTime.wHour, systemTime.wMinute, systemTime.wSecond, systemTime.wMilliseconds, iInterval);


  char buff[1024] = {0,};
  wchar_t wszbuff[1024] = {0,};
  va_list args;
  va_start(args,szFormat);
  _vsnprintf(buff, 1023, szFormat,args);
  va_end(args);

  MByteToWChar(buff, wszbuff, sizeof(wszbuff)/sizeof(wszbuff[0]));
#ifdef _WIN32
	OutputDebugString(wszbuff);
#endif
	printf("TRACE: %s", buff);
#endif

}
Пример #4
0
PWSTR TitleMByteToWChar(PCSTR AnsiString)
{
    if (AnsiString[0] == -1)
    {
        PWSTR ResourceId = (PWSTR)AllocateMemoryP(6);
        if (ResourceId == NULL)
            return NULL;

        ResourceId[0] = 0xFFFF;
        ResourceId[1] = *(PUSHORT)&AnsiString[1];
        ResourceId[2] = 0;

        return ResourceId;
    }

    return MByteToWChar(AnsiString);
}
Пример #5
0
int		SSQ_TRACE(char* szFormat, ...)
{
#ifdef _DEBUG
  char buff[1024] = {0,};
  wchar_t wszbuff[1024] = {0,};
  va_list args;
  va_start(args,szFormat);
  _vsnprintf(buff, 1023, szFormat,args);
  va_end(args);

  MByteToWChar(buff, wszbuff, sizeof(wszbuff)/sizeof(wszbuff[0]));
#ifdef _WIN32
	OutputDebugString(wszbuff);
#endif
	printf("TRACE: %s", buff);
#endif

	return 0;
}
Пример #6
0
	void MBToWC(const char* lpcszStr, wchar_t*& lpwszStr, int dwSize){
		lpwszStr = (wchar_t*)malloc(dwSize);
		memset(lpwszStr, 0, dwSize);
		int iSize = (MByteToWChar(lpwszStr, lpcszStr, strlen(lpcszStr)) + 1)*sizeof(wchar_t);
		lpwszStr = (wchar_t*)realloc(lpwszStr, iSize);
	}
Пример #7
0
PWSTR ClassMByteToWChar(PCSTR AnsiString)
{
    return IS_ATOM(AnsiString) ? (PWSTR)AnsiString : MByteToWChar(AnsiString);
}