⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vutils.h

📁 这个是微软WINCE的OBEX协议例子
💻 H
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
#ifndef VUTILS_H
#define VUTILS_H
#include <windows.h>
#include <stdio.h>
#include <tchar.h>
#include <winsock.h>
#include <bldver.h>
#include "addrmapi.h"
#include "pegmapi.h"

#define ARRAYSIZE(x) (sizeof(x) / sizeof(x[1]))
#define PFUNCT_CONVERT unsigned ( __stdcall *start_address )( void * )

#define VCARD_HEADER "BEGIN:VCARD\r\nVERSION:2.1\r\n"
#define VCARD_FOOTER "END:VCARD\r\n"


//defination of input functions
typedef CEPROPVAL *(pFunctInput) (CEPROPID propID, LPSTR type, LPSTR field, void *pState);

//node for linked list of CEPROVAL's... used to hold all records
//  as they are parsed
struct CEPROP_LIST
{
	CEPROPVAL *prop;
	CEPROP_LIST *pNext;
};

//node for linked list of string pointers
struct StringList {
	StringList 	*pNext;
	char *		pEntry;
};


//linked list of VCARD entries
struct VCARD_ENTRY_LIST {
	VCARD_ENTRY_LIST	*pNext;
	StringList		*pMembers;
	UINT			iOrd;
};

//node for list of a VCARD line entry
struct VCARD_LINE {
	VCARD_LINE	    	*pNext;
	char 			    *pName; 		
	VCARD_ENTRY_LIST	*pLineEntries;	
};	


//element in the main lookup table.  this contains
//  info on which OID's to use for what input 
struct OID_TRANSLATOR {
	char		*line_name;
	void 		*toString;
	pFunctInput *inputFunct;
	DWORD 		oid_id;
	int			iOrd;
};

//struct to hold OID and its size
struct OID_STRUCT {
	OID_TRANSLATOR *pTrans;
	UINT uiNumElements;
};


//structure that contains state information for a vCard entry... this is
//   used to hold data that must be parsed AFTER all the the entries 
//   have been read.  NOTE: this is just a container, and pointers in 
//   it are NOT owned by the container. 
struct VCardStateObj
{
    CEPROPVAL *pGiven;
    CEPROPVAL *pSurName;
};

//structure that contains state information for a vCal entries... this is
//   used to hold data that must be parsed AFTER all the the entries 
//   have been read
struct VCalStateObj
{
	FILETIME *startTime;
	FILETIME *stopTime;
};

class VCARD_PROP;

//primary parsing function
char *ParseVCard(CEPROP_LIST *pCL, OID_STRUCT *pOID, char *vCard, void *pState);

//input fuctions (used to do parsing/conversion of data AFTER found
//  in the lookup table
CEPROPVAL *vCalInputFunct(CEPROPID propID, LPSTR type, LPSTR field, void *pState);
CEPROPVAL *vCardInputFunct(CEPROPID propID, LPSTR type, LPSTR field, void *pState);


//DANGEROUS FUNCTIONS:  these ALLOCATE memory they *DONT* free
char *UnicodeToChar(LPTSTR dta);


//UTILITY FUNCTIONS
BOOL StartDateToFileTime(LPSTR dta, LPFILETIME pFileTime);

//Utils to get info on the table
UINT TABLE_getTableSize();
OID_TRANSLATOR *TABLE_getTable();


extern OID_TRANSLATOR g_sCalendarOidTranslator[];
extern OID_TRANSLATOR g_sContactOidTranslator[];
extern UINT g_CalendarSize;
extern UINT g_ContactSize;

#ifdef MEM_DEBUG
  #define DEBUG_MEM_CEPROPVAL   2
  #define DEBUG_MEM_WCHAR       3
  #define DEBUG_MEM_FILETIME    4
  #define DEBUG_MEM_CEPROP_LIST 5
  #define DEBUG_MEM_CHAR        6
#else
#define Debug_PrintMemUsage(x)
#endif

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -