Esempio n. 1
0
static void createXMLSetting(const char * name, const char * description, const char * value)
{
	item = mxmlNewElement(section, "setting");
	mxmlElementSetAttr(item, "name", name);
	mxmlElementSetAttr(item, "value", value);
	mxmlElementSetAttr(item, "description", description);
}
Esempio n. 2
0
VOID 
NTAPI
HookedLdrHotPatchRoutine(
	HotPatchBuffer * s_HotPatchBuffer
	)
{
	DEBUG_PRINTF(LSHL, NULL, "HookedLdrHotPatchRoutine called.\n");
	PXMLNODE XmlIDLogNode;
	XmlIDLogNode = mxmlNewElement( XmlShellcode, "row");
	mxmlElementSetAttr(XmlIDLogNode, "type", ANALYSIS_TYPE_API);
	mxmlElementSetAttr(XmlIDLogNode, "api", "LdrHotPatchRoutine");
	mxmlElementSetAttrf(XmlIDLogNode, "value", "%ls,%ls", s_HotPatchBuffer->PatcherName,  s_HotPatchBuffer->PatcheeName);
	if (PWNYPOT_REGCONFIG.SHELLCODE.ALLOW_MALWARE_DOWNLOAD)
	{
		//mxmlElementSetAttr(XmlIDLogNode, "downloaded_dll", "1");
		SaveXml( XmlLog );
		LdrHotPatchRoutine_(s_HotPatchBuffer);
	}
	else {
		//mxmlElementSetAttr(XmlIDLogNode, "downloaded_dll", "0");
		SaveXml( XmlLog );
		DEBUG_PRINTF(LSHL, NULL, "Denied downloading of library because of ALLOW_MALWARE_DOWNLOAD=0");
	}
	
}
Esempio n. 3
0
int
WSAAPI
Hookedrecv(
	SOCKET s,
	char *buf,
	int len,
	int flags
	)
{

	if ( DbgGetShellcodeFlag() == PWNYPOT_STATUS_SHELLCODE_FLAG_SET && len > 1)
	{
		CHAR szPort[20];
        CHAR szUID[UID_SIZE];
		sockaddr_in sdata;
		int sock_len = sizeof(sockaddr);
		PXMLNODE XmlIDLogNode;
			
		XmlIDLogNode = mxmlNewElement( XmlShellcode, "row");
		// type
		mxmlElementSetAttr(XmlIDLogNode, "type", ANALYSIS_TYPE_RECV);
		getpeername( s, (sockaddr *)&sdata, &sock_len);
		mxmlElementSetAttrf(XmlIDLogNode, "socket", "%d", s);
		mxmlElementSetAttr(XmlIDLogNode, "recv_ip", inet_ntoa(sdata.sin_addr));
		mxmlElementSetAttr(XmlIDLogNode, "recv_port", _itoa(htons(sdata.sin_port), szPort, 10));
		mxmlElementSetAttr(XmlIDLogNode, "recv_datalen", _itoa(len, szPort, 10));
		mxmlElementSetAttr(XmlIDLogNode, "data_uid", GenRandomStr(szUID, UID_SIZE-1));
        HexDumpToFile((PBYTE)buf, len ,szUID);
		// save
		SaveXml( XmlLog );
	}

	return (recv_( s, buf, len, flags));
}
Esempio n. 4
0
/**
 * Dumps an Objects scripts into the XML node.
 * @param obj_node XML node.
 * @param object The object.
 */
void FileProcessor::saveArea_Script(mxml_node_t* obj_node, Object* object) {
	if(strcmp(object->getScript(SCRIPT_ONUPDATE).c_str(), "") != 0) {
		mxml_node_t *pos_node = mxmlNewElement(obj_node, "script");
		mxmlElementSetAttr(pos_node, "type", "onupdate");
		mxmlElementSetAttr(pos_node, "filename", object->getScript(SCRIPT_ONUPDATE).c_str());
	}
}
Esempio n. 5
0
/**
 * Dumps all tile in an area into the xml node.
 * @param area The refrence to the area.
 * @param area_node The pointer to the xml node.
 */
void FileProcessor::saveArea_Tiles(mxml_node_t* area_node, Area& area) {
	mxml_node_t *tiles_node = mxmlNewElement(area_node, "tiles");
	for(int y = 0; y < area.getHeight(); y++) {
		for(int x = 0; x < area.getWidth(); x++) {

			Tile* tile = area.getTile(x, y);
			if(!tile) {
				continue;
			}

			mxml_node_t *tile_node = mxmlNewElement(tiles_node, "tile");
			mxmlElementSetAttrf(tile_node, "x", "%d", x);
			mxmlElementSetAttrf(tile_node, "y", "%d", y);

			const char* solid = "false";
			if(area.getSolid(x, y)) {
				solid = "true";
			}
			mxmlElementSetAttr(tile_node, "solid", solid);

			const char* filename = tile->getFilename().c_str();
			mxmlElementSetAttr(tile_node, "filename", filename);

			mxmlElementSetAttrf(tile_node, "rotation", "%f", tile->getRotation());
		}
	}
}
Esempio n. 6
0
NTSTATUS
WINAPI
HookedNtSetInformationProcess(
	HANDLE ProcessHandle,
    ULONG ProcessInformationClass,
    PVOID ProcessInformation,
    ULONG ProcessInformationLength 
    )
{
	if (ProcessInformationClass == ProcessExecuteFlags){
		PXMLNODE XmlIDLogNode;
		XmlIDLogNode = mxmlNewElement( XmlShellcode, "row");
		mxmlElementSetAttr(XmlIDLogNode, "type", ANALYSIS_TYPE_API);
		mxmlElementSetAttr(XmlIDLogNode, "api", "NtSetInformationProcess");
		mxmlElementSetAttrf(XmlIDLogNode, "value", "0x%p", (*(ULONG_PTR *)ProcessInformation));
		SaveXml( XmlLog );
		if (PWNYPOT_REGCONFIG.GENERAL.ALLOW_MALWARE_EXEC) 
		{
			DEBUG_PRINTF(LSHL, NULL, "HookedNtSetInformationProcess is called with ProcessExecuteFlags value: %p.\n", (*(ULONG_PTR *)ProcessInformation) );
			return NtSetInformationProcess_(ProcessHandle, ProcessInformationClass, ProcessInformation, ProcessInformationLength);
		}
		else 
		{				 
			if (((*(ULONG_PTR *)ProcessInformation) & MEM_EXECUTE_OPTION_ENABLE) == 0x2 )
			{
				DEBUG_PRINTF(LSHL, NULL, "Stopping Process because it was trying to disable DEP.\n");
				TerminateProcess(GetCurrentProcess(), STATUS_ACCESS_VIOLATION);
			}
		}
	}
	return 0;
}
Esempio n. 7
0
BOOL
WINAPI
HookedSetProcessDEPPolicy(
	DWORD dwFlags
	)
{
	PXMLNODE XmlIDLogNode;
	XmlIDLogNode = mxmlNewElement( XmlShellcode, "row");
	mxmlElementSetAttr(XmlIDLogNode, "type", ANALYSIS_TYPE_API);
	mxmlElementSetAttr(XmlIDLogNode, "api", "SetProcessDEPPolicy");
	mxmlElementSetAttrf(XmlIDLogNode, "value", "%d", dwFlags);
	if (PWNYPOT_REGCONFIG.GENERAL.ALLOW_MALWARE_EXEC) 
	{
		SaveXml( XmlLog );
		return SetProcessDEPPolicy_(dwFlags);
	}
	else 
	{	
		if (dwFlags == 0)
		{
			DEBUG_PRINTF(LSHL, NULL, "Stopping Process because it was trying to disable DEP.\n");
			SaveXml( XmlLog );
			TerminateProcess(GetCurrentProcess(), STATUS_ACCESS_VIOLATION);
		}
	}
	return 0;
}
Esempio n. 8
0
XMLwrapper::XMLwrapper(){
    ZERO(&parentstack,(int)sizeof(parentstack));
    ZERO(&values,(int)sizeof(values));

    minimal=true;
    stackpos=0;

    tree=mxmlNewElement(MXML_NO_PARENT,"?xml version=\"1.0\" encoding=\"UTF-8\"?");
/*  for mxml 2.1 (and older)
    tree=mxmlNewElement(MXML_NO_PARENT,"?xml"); 
    mxmlElementSetAttr(tree,"version","1.0");
    mxmlElementSetAttr(tree,"encoding","UTF-8");
*/
    
    mxml_node_t *doctype=mxmlNewElement(tree,"!DOCTYPE");
    mxmlElementSetAttr(doctype,"paulstretch-data",NULL);

    node=root=mxmlNewElement(tree,"paulstretch-data");
        
    mxmlElementSetAttr(root,"version-major","1");
    mxmlElementSetAttr(root,"version-minor","0");
    mxmlElementSetAttr(root,"paulstretch-author","Nasca Octavian Paul");

    //make the empty branch that will contain the information parameters
    info=addparams0("INFORMATION");
    
    //save specifications
    beginbranch("BASE_PARAMETERS");
    endbranch();

};
Esempio n. 9
0
int
WSAAPI
Hookedbind(
  SOCKET s,
  const struct sockaddr *name,
  int namelen
  )
{
	if ( DbgGetShellcodeFlag() == PWNYPOT_STATUS_SHELLCODE_FLAG_SET )
	{
		PXMLNODE XmlIDLogNode;
		CHAR szPort[20];
		sockaddr_in *sdata;
		sdata = (sockaddr_in *)name;

		XmlIDLogNode = mxmlNewElement( XmlShellcode, "row");
		// type
		mxmlElementSetAttr(XmlIDLogNode, "type", ANALYSIS_TYPE_BIND);
		mxmlElementSetAttrf(XmlIDLogNode, "socket", "%d", s);
		mxmlElementSetAttr(XmlIDLogNode, "bind_ip", inet_ntoa(sdata->sin_addr));
		mxmlElementSetAttr(XmlIDLogNode, "bind_port", _itoa(htons(sdata->sin_port),szPort, 10));
		// save
		SaveXml( XmlLog );
	}

	return (bind_(s, name, namelen));
}
Esempio n. 10
0
/**
 * Adds a specific device to the XML document
 *
 * @param device_to_add The device to add
 *
 * @return returns HPD_E_SUCCESS if successful and HPD_E_DEVICE_ALREADY_IN_XML or HPD_E_XML_ERROR  if failed
 */
  int 
add_device_to_xml(Device *device_to_add)
{

  if(device_is_in_xml_file (device_to_add) == HPD_YES)
    return HPD_E_DEVICE_ALREADY_IN_XML;

  mxml_node_t *devicelist;
  mxml_node_t *new_device;

  devicelist = mxmlFindElement(service_xml_file->xml_tree, service_xml_file->xml_tree, "devicelist", NULL, NULL, MXML_DESCEND);
  if(devicelist == NULL)
  {
    printf("No \"devicelist\" in the XML file\n");
    return HPD_E_XML_ERROR;
  }

  new_device = mxmlNewElement(devicelist, "device");
  if(device_to_add->description != NULL) mxmlElementSetAttr(new_device, "desc", device_to_add->description);
  if(device_to_add->ID != NULL) mxmlElementSetAttr(new_device, "id", device_to_add->ID);
  if(device_to_add->vendorID != NULL) mxmlElementSetAttr(new_device, "vendorid", device_to_add->vendorID);
  if(device_to_add->productID != NULL) mxmlElementSetAttr(new_device, "productid", device_to_add->productID);
  if(device_to_add->version != NULL) mxmlElementSetAttr(new_device, "version", device_to_add->version);
  if(device_to_add->IP != NULL) mxmlElementSetAttr(new_device, "ip", device_to_add->IP);
  if(device_to_add->port != NULL) mxmlElementSetAttr(new_device, "port", device_to_add->port);
  if(device_to_add->location != NULL) mxmlElementSetAttr(new_device, "location", device_to_add->location);
  if(device_to_add->type != NULL) mxmlElementSetAttr(new_device, "type", device_to_add->type);

  save_xml_tree (); 

  return HPD_E_SUCCESS;
}
Esempio n. 11
0
void HwmonDriver::writeEvents(mxml_node_t *root) const {
	root = mxmlNewElement(root, "category");
	mxmlElementSetAttr(root, "name", "hwmon");

	char buf[1024];
	for (HwmonCounter *counter = static_cast<HwmonCounter *>(getCounters()); counter != NULL; counter = static_cast<HwmonCounter *>(counter->getNext())) {
		mxml_node_t *node = mxmlNewElement(root, "event");
		mxmlElementSetAttr(node, "counter", counter->getName());
		mxmlElementSetAttr(node, "title", counter->getTitle());
		if (counter->isDuplicate()) {
			mxmlElementSetAttrf(node, "name", "%s (0x%x)", counter->getLabel(), counter->getKey());
		} else {
			mxmlElementSetAttr(node, "name", counter->getLabel());
		}
		mxmlElementSetAttr(node, "display", counter->getDisplay());
		mxmlElementSetAttr(node, "class", counter->getCounterClass());
		mxmlElementSetAttr(node, "units", counter->getUnit());
		if (counter->getModifier() != 1) {
			mxmlElementSetAttrf(node, "modifier", "%d", counter->getModifier());
		}
		if (strcmp(counter->getDisplay(), "average") == 0 || strcmp(counter->getDisplay(), "maximum") == 0) {
			mxmlElementSetAttr(node, "average_selection", "yes");
		}
		snprintf(buf, sizeof(buf), "libsensors %s sensor %s (%s)", counter->getTitle(), counter->getLabel(), counter->getName());
		mxmlElementSetAttr(node, "description", buf);
	}
}
Esempio n. 12
0
/**
 * Extracts the device XML description given its internal structure
 *
 * @param device_to_extract The Device that we want to extract
 *
 * @return The XML description of the device or NULL if failed
 */
  char *
extract_device_xml(Device *device_to_extract)
{
  if(device_is_in_xml_file (device_to_extract) == HPD_NO)
    return NULL;

  mxml_node_t *xml;
  xml = mxmlNewXML("1.0");

  mxml_node_t *new_device;

  new_device = mxmlNewElement(xml, "device");
  if(device_to_extract->description != NULL) mxmlElementSetAttr(new_device, "desc", device_to_extract->description);
  if(device_to_extract->ID != NULL) mxmlElementSetAttr(new_device, "id", device_to_extract->ID);
  if(device_to_extract->vendorID != NULL) mxmlElementSetAttr(new_device, "vendorID", device_to_extract->vendorID);
  if(device_to_extract->productID != NULL) mxmlElementSetAttr(new_device, "productID", device_to_extract->productID);
  if(device_to_extract->version != NULL) mxmlElementSetAttr(new_device, "version", device_to_extract->version);
  if(device_to_extract->IP != NULL) mxmlElementSetAttr(new_device, "ip", device_to_extract->IP);
  if(device_to_extract->port != NULL) mxmlElementSetAttr(new_device, "port", device_to_extract->port);
  if(device_to_extract->location != NULL) mxmlElementSetAttr(new_device, "location", device_to_extract->location);
  if(device_to_extract->type != NULL) mxmlElementSetAttr(new_device, "type", device_to_extract->type);

  char* return_string = mxmlSaveAllocString(xml, MXML_NO_CALLBACK);

  mxmlDelete(xml);

  return return_string;
}
Esempio n. 13
0
/**
 * Dumps an Object into the xml node.
 * @param object The refrence to the object.
 * @param obj_node The pointer to the xml node.
 */
void FileProcessor::saveArea_Object(mxml_node_t* obj_node, Object* object) {
	saveArea_Tag(obj_node, object);
	if(object->isVisible()) {
		mxmlElementSetAttr(obj_node, "visible", "true");
	} else {
		mxmlElementSetAttr(obj_node, "visible", "false");
	}
	#warning ['TODO']: Fix me!
	saveArea_Position(obj_node, object);
	saveArea_Rotation(obj_node, object);
	saveArea_Visual(obj_node, object);
	saveArea_Script(obj_node, object);
}
Esempio n. 14
0
static void createXMLController(unsigned int controller[], const char * name, const char * description)
{
	item = mxmlNewElement(section, "controller");
	mxmlElementSetAttr(item, "name", name);
	mxmlElementSetAttr(item, "description", description);

	// create buttons
	for(int i=0; i < MAXJP; i++)
	{
		elem = mxmlNewElement(item, "button");
		mxmlElementSetAttr(elem, "number", toStr(i));
		mxmlElementSetAttr(elem, "assignment", toStr(controller[i]));
	}
}
Esempio n. 15
0
int update_service_xml( Service *service )
{
  mxml_node_t *xml_service;
  mxml_node_t *xml_device;

  for (xml_device = mxmlFindElement(service_xml_file->xml_tree, 
	service_xml_file->xml_tree,
	"device", 
	NULL, 
	NULL, 
	MXML_DESCEND);
      xml_device != NULL;
      xml_device = mxmlFindElement(	xml_device, 
	service_xml_file->xml_tree,
	"device", 
	NULL, 
	NULL, 
	MXML_DESCEND))
  {
    if(strcmp(mxmlElementGetAttr(xml_device,"type") , service->device->type) == 0
	&& strcmp(mxmlElementGetAttr(xml_device,"id") , service->device->ID) == 0)
    {
      for (xml_service = mxmlFindElement(xml_device, 
	    xml_device,
	    "service", 
	    NULL, 
	    NULL, 
	    MXML_DESCEND);
	  xml_service != NULL;
	  xml_service = mxmlFindElement(xml_service, 
	    xml_device,
	    "service", 
	    NULL, 
	    NULL, 
	    MXML_DESCEND))
      {
	if(strcmp(mxmlElementGetAttr(xml_service,"type") , service->type) == 0
	    && strcmp(mxmlElementGetAttr(xml_service,"id") , service->ID) == 0)
	{
	  if(service->description != NULL) mxmlElementSetAttr(xml_service, "desc", service->description);
	  if(service->unit != NULL) mxmlElementSetAttr(xml_service, "unit", service->unit);
	  save_xml_tree();
	  return HPD_YES;
	}
      }
    }
  }
  return HPD_NO;
}
Esempio n. 16
0
static void setElementFloat(mxml_node_t* node, char* attr, float v)
{
	char temp[256];
	memset(temp, 0, sizeof(temp));
	sprintf(temp, "%f", v); 
	mxmlElementSetAttr(node, attr, temp); 
}
Esempio n. 17
0
static void setElementInt(mxml_node_t* node, const char* attr, const char* format, int v)
{
	char temp[256];
	memset(temp, 0, sizeof(temp));
	sprintf(temp, format, v); 
	mxmlElementSetAttr(node, attr, temp); 
}
Esempio n. 18
0
int
WSAAPI
Hookedlisten(
	SOCKET s,
	int backlog
	)
{
	if ( DbgGetShellcodeFlag() == PWNYPOT_STATUS_SHELLCODE_FLAG_SET )
	{
		PXMLNODE XmlIDLogNode;
		PXMLNODE XmlLogNode;

		XmlIDLogNode = mxmlNewElement( XmlShellcode, "row");
		// type
		mxmlElementSetAttr(XmlIDLogNode, "type", ANALYSIS_TYPE_LISTEN);
		// listen
		mxmlElementSetAttrf(XmlIDLogNode, "socket", "%d", s);
		XmlLogNode = mxmlNewElement( XmlIDLogNode, "listen_desc");
		mxmlNewText( XmlLogNode, 0, "Shellcode attemp to listen on a port (possibly on previously bind address).");
		// save
		SaveXml( XmlLog );
	}

	return (listen_( s,backlog ));
}
Esempio n. 19
0
mxml_node_t *PhpCreateSettingElement(
    _Inout_ mxml_node_t *ParentNode,
    _In_ PPH_STRINGREF SettingName,
    _In_ PPH_STRINGREF SettingValue
    )
{
    mxml_node_t *settingNode;
    mxml_node_t *textNode;
    PPH_BYTES settingNameUtf8;
    PPH_BYTES settingValueUtf8;

    // Create the setting element.

    settingNode = mxmlNewElement(ParentNode, "setting");

    settingNameUtf8 = PhConvertUtf16ToUtf8Ex(SettingName->Buffer, SettingName->Length);
    mxmlElementSetAttr(settingNode, "name", settingNameUtf8->Buffer);
    PhDereferenceObject(settingNameUtf8);

    // Set the value.

    settingValueUtf8 = PhConvertUtf16ToUtf8Ex(SettingValue->Buffer, SettingValue->Length);
    textNode = mxmlNewOpaque(settingNode, settingValueUtf8->Buffer);
    PhDereferenceObject(settingValueUtf8);

    return settingNode;
}
Esempio n. 20
0
mxml_node_t *CreateObjectElement(
    _Inout_ mxml_node_t *ParentNode,
    _In_ PPH_STRINGREF Tag,
    _In_ PPH_STRINGREF Name,
    _In_ PPH_STRINGREF PriorityClass,
    _In_ PPH_STRINGREF IoPriorityPlusOne,
    _In_ PPH_STRINGREF Comment,
    _In_ PPH_STRINGREF BackColor,
    _In_ PPH_STRINGREF Collapse,
    _In_ PPH_STRINGREF AffinityMask
    )
{
    mxml_node_t *objectNode;
    mxml_node_t *textNode;

    // Create the setting element.
    objectNode = mxmlNewElement(ParentNode, "object");

    // Set the attributes.
    mxmlElementSetAttr(objectNode, "tag", StringRefToUtf8(Tag)->Buffer);
    mxmlElementSetAttr(objectNode, "name", StringRefToUtf8(Name)->Buffer);
    mxmlElementSetAttr(objectNode, "priorityclass", StringRefToUtf8(PriorityClass)->Buffer);
    mxmlElementSetAttr(objectNode, "iopriorityplusone", StringRefToUtf8(IoPriorityPlusOne)->Buffer);
    mxmlElementSetAttr(objectNode, "backcolor", StringRefToUtf8(BackColor)->Buffer);
    mxmlElementSetAttr(objectNode, "collapse", StringRefToUtf8(Collapse)->Buffer);
    mxmlElementSetAttr(objectNode, "affinity", StringRefToUtf8(AffinityMask)->Buffer);

    // Set the value.
    textNode = mxmlNewOpaque(objectNode, StringRefToUtf8(Comment)->Buffer);

    return objectNode;
}
Esempio n. 21
0
static int
preparePalData (gamePalette pals[], int palCount)
{
	xml = mxmlNewXML("1.0");
	mxmlSetWrapMargin(0); // disable line wrapping

	data = mxmlNewElement(xml, "palette");
	mxmlElementSetAttr(data, "app", APPNAME);
	mxmlElementSetAttr(data, "version", APPVERSION);
	for (int i=0; i<palCount; i++)
		createXMLPalette(&pals[i], false);

	int datasize = mxmlSaveString(xml, (char *)savebuffer, SAVEBUFFERSIZE, XMLSavePalCallback);

	mxmlDelete(xml);

	return datasize;
}
Esempio n. 22
0
/**
 * Initialization of the services.xml file that will be used
 * throughout the whole process
 *
 * @param name the name of the devicelist
 * @param id the id of the devicelist
 *
 * @return returns HPD_E_SUCCESS if successful
 */
  int 
init_xml_file(char *name, char *id)
{

  create_service_xml_file();

  mxml_node_t *devicelist;   

  service_xml_file->xml_tree = mxmlNewXML("1.0");
  devicelist = mxmlNewElement(service_xml_file->xml_tree, "devicelist");
  mxmlElementSetAttr(devicelist, "name", name);
  mxmlElementSetAttr(devicelist, "id", id);
  mxmlElementSetAttr(devicelist, "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
  mxmlElementSetAttr(devicelist, "xsi:noNamespaceSchemaLocation", "http://cs.au.dk/dithus/xml/devicedescription.xsd");

  save_xml_tree();
  return HPD_E_SUCCESS;
}
Esempio n. 23
0
/**
 * Returns an internal char* of a value under the form of :
 * "<?xml version="1.0" encoding="UTF-8"?><subscription timestamp = xxxxxx url = yyyyy>yes/no</subscription>"
 *
 * @param value The value
 *
 * @param url The URL of the Service
 *
 * @return Returns the char* corresponding
 */
  char * 
get_xml_subscription(char* value, char *url)
{
  mxml_node_t *xml;
  mxml_node_t *xml_value;

  xml = mxmlNewXML("1.0");
  xml_value = mxmlNewElement(xml, "subscription");
  mxmlElementSetAttr(xml_value, "timestamp", timestamp());
  mxmlElementSetAttr(xml_value, "url", url);
  mxmlNewText(xml_value, 0, value);

  char* return_value = mxmlSaveAllocString(xml, MXML_NO_CALLBACK);

  mxmlDelete(xml);

  return return_value;
}
Esempio n. 24
0
static mxml_node_t *mxmlFindNewElement(mxml_node_t *parent, const char *nodename, const char *attr=NULL, const char *value=NULL)
{
	mxml_node_t *node = mxmlFindElement(parent, xml, nodename, attr, value, MXML_DESCEND);
	if (!node)
	{
		node = mxmlNewElement(parent, nodename);
		if (attr && value) mxmlElementSetAttr(node, attr, value);
	}
	return node;
}
Esempio n. 25
0
int PerfDriver::writeCounters(mxml_node_t *root) const {
	int count = 0;
	for (PerfCounter * counter = mCounters; counter != NULL; counter = counter->getNext()) {
		mxml_node_t *node = mxmlNewElement(root, "counter");
		mxmlElementSetAttr(node, "name", counter->getName());
		++count;
	}

	return count;
}
Esempio n. 26
0
void IAPointsSerializer::addNodoXMLIAPoints(size_t id, punto point, Ogre::Quaternion rotacion)
{
    _nodeIAPoint = mxmlNewElement(_data, "point");
    //mxmlNewText(_nodeIAPoint , 0, "val1");
    mxmlElementSetAttr(_nodeIAPoint,"x",std::to_string(point.p.x).c_str());
    mxmlElementSetAttr(_nodeIAPoint,"y",std::to_string(point.p.y).c_str());
    mxmlElementSetAttr(_nodeIAPoint,"z",std::to_string(point.p.z).c_str());
    mxmlElementSetAttr(_nodeIAPoint,"offset",std::to_string(0.0).c_str()); // cambiarlo luego al campo adecuado de un iacomplexpoint
    mxmlElementSetAttr(_nodeIAPoint,"qW",std::to_string(rotacion.w).c_str());
    mxmlElementSetAttr(_nodeIAPoint,"qX",std::to_string(rotacion.x).c_str());
    mxmlElementSetAttr(_nodeIAPoint,"qY",std::to_string(rotacion.y).c_str());
    mxmlElementSetAttr(_nodeIAPoint,"qZ",std::to_string(rotacion.z).c_str());
}
Esempio n. 27
0
int FSDriver::writeCounters(mxml_node_t *root) const {
	int count = 0;
	for (FSCounter *counter = static_cast<FSCounter *>(getCounters()); counter != NULL; counter = static_cast<FSCounter *>(counter->getNext())) {
		if (access(counter->getPath(), R_OK) == 0) {
			mxml_node_t *node = mxmlNewElement(root, "counter");
			mxmlElementSetAttr(node, "name", counter->getName());
			++count;
		}
	}

	return count;
}
Esempio n. 28
0
static int preparePrefsData() {
	xml = mxmlNewXML("1.0");
	mxmlSetWrapMargin(0); // disable line wrapping

	data = mxmlNewElement(xml, "file");
	mxmlElementSetAttr(data, "app", APPNAME);
	mxmlElementSetAttr(data, "version", APPVERSION);

	createXMLSection("Menu", "Menu Settings");

	createXMLSetting("ExitAction", "Exit Action", toStr(XMPlayerCfg.exit_action));
	createXMLSetting("language", "Language", toStr(XMPlayerCfg.language));
	createXMLSetting("sort_order", "Sort Order", toStr(XMPlayerCfg.sort_order));

	int datasize = mxmlSaveString(xml, (char *) savebuffer, SAVEBUFFERSIZE, XMLSaveCallback);

	mxmlDelete(xml);
	
	printf("XMPlayerCfg.language : %d\n",XMPlayerCfg.language);

	return datasize;
}
Esempio n. 29
0
int Hwmon::writeCounters(mxml_node_t *root) const {
	int count = 0;
	for (HwmonCounter * counter = counters; counter != NULL; counter = counter->getNext()) {
		if (!counter->canRead()) {
			continue;
		}
		mxml_node_t *node = mxmlNewElement(root, "counter");
		mxmlElementSetAttr(node, "name", counter->getName());
		++count;
	}

	return count;
}
Esempio n. 30
0
HRESULT
WINAPI
HookedURLDownloadToFileW(
    LPUNKNOWN pCaller,
    LPCWSTR szURL,
    LPCWSTR szFileName,
    DWORD dwReserved,
    LPBINDSTATUSCALLBACK lpfnCB
	)
{
	if ( DbgGetShellcodeFlag() == PWNYPOT_STATUS_SHELLCODE_FLAG_SET )
	{
		CHAR *szUrlA			= (CHAR *)LocalAlloc(LMEM_ZEROINIT, 1024);
		CHAR *szFileNameA		= (CHAR *)LocalAlloc(LMEM_ZEROINIT, 1024);
		PXMLNODE XmlIDLogNode;

		if ( szURL != NULL )
			wcstombs( szUrlA, szURL, 1024);

		if ( szFileName != NULL )
			wcstombs( szFileNameA, szFileName, 1024);

		XmlIDLogNode = mxmlNewElement( XmlShellcode, "row");
		/* type */
		mxmlElementSetAttr(XmlIDLogNode, "type", ANALYSIS_TYPE_DL2FILE);
		mxmlElementSetAttr(XmlIDLogNode, "download_url", (PCHAR)szUrlA);
		mxmlElementSetAttr(XmlIDLogNode, "download_filename", (PCHAR)szFileNameA);
		/* save */
		SaveXml( XmlLog );

		if ( PWNYPOT_REGCONFIG.SHELLCODE.ALLOW_MALWARE_DOWNLOAD == FALSE )
			return S_OK;

		LocalFree(szUrlA);
		LocalFree(szFileNameA);
	}

	return (URLDownloadToFileW_( pCaller, szURL, szFileName, dwReserved, lpfnCB));
}