Thread: HTTPd
View Single Post
Old 02-03-2004, 03:30 AM  
darkone
Disabled
 
darkone's Avatar
 
Join Date: Dec 2001
Posts: 2,230
Default

Wii.. all user_ commands were added (I was kind enough to add error definitions php api, is quite nice for adding new commands)

io_user_open command looks following:

Code:
/* proto object io_user_open(uid)
   Open user */
PHP_FUNCTION(io_user_open)
{
	LONG		Uid;
	LPPHP_USERFILE	lpUserFile;

	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
		"l", &Uid) == FAILURE) return;

	if (Uid < 0 || Uid >= MAX_UID)
	{
		php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid UID");
		RETURN_FALSE;
	}

	lpUserFile	= (LPPHP_USERFILE)Allocate("PHP:UserFile", sizeof(USERFILE));
	if (! lpUserFile) RETURN_FALSE
	ZeroMemory(lpUserFile, sizeof(PHP_USERFILE));

	if (UserFile_OpenPrimitive(Uid, &lpUserFile->lpUserFile, 0))
	{
		Php_SetError(GetLastError(), TSRMLS_CC);
		Free(lpUserFile);
		RETURN_FALSE;
	}

	ZEND_REGISTER_RESOURCE(return_value, lpUserFile, iUserFile);
}
darkone is offline   Reply With Quote