Exemplo n.º 1
0
WRAPPER_EXPORT struct hostent FAR * PASCAL FAR
gethostbyname(const char FAR * name) {
	struct hostent FAR *ret;
	char    nbuff[256];
	char    hbuff[256];
	BOOL    stat;
	idn_resconf_t	encodeCtx;
    
	TRACE("ENTER gethostbyname <%-.100s>\n",
	      (name != NULL ? name : "NULL"));

	encodeCtx = idnGetContext();

	if (encodeCtx == NULL) {
		TRACE("gethostbyname: not encode here\n");
		ret = _org_gethostbyname(name);
	} else if (name == NULL) {
		TRACE("gethostbyname: name is NULL\n");
		ret = _org_gethostbyname(name);
	} else {
		stat = idnConvReq(encodeCtx, name, nbuff, sizeof(nbuff));
		if (stat == FALSE) {
			TRACE("idnConvReq failed\n");
			ret = NULL;
		} else {
			TRACE("Converted Name <%s>\n",
			      dumpName(nbuff, hbuff, sizeof(hbuff)));
			ret = _org_gethostbyname(nbuff);
		}
	}

	if (ret != NULL && encodeCtx != NULL) {
		TRACE("Resulting Name <%s>\n",
		      dumpName(ret->h_name, hbuff, sizeof(hbuff)));
		stat = idnConvRsp(encodeCtx, ret->h_name, nbuff,
				  sizeof(nbuff));
		if (stat == FALSE) {
			TRACE("Decoding failed - return the name verbatim\n");
		} else {
			TRACE("Converted Back <%s>\n",
			      dumpName(nbuff, hbuff, sizeof(hbuff)));
			strcpy(ret->h_name, nbuff);
		}
	}

	if (ret == NULL) {
		TRACE("LEAVE gethostbyname NULL\n");
	} else {
		TRACE("LEAVE gethostbyname <%s>\n",
		      dumpHost(ret, hbuff, sizeof(hbuff)));
	}
	return (ret);
}
Exemplo n.º 2
0
WRAPPER_EXPORT HANDLE PASCAL FAR
WSAAsyncGetHostByName(HWND hWnd, u_int wMsg, 
		      const char FAR * name, char FAR * buf, int buflen)
{
	HANDLE  ret;
	char    nbuff[256];
	char    hbuff[256];
	idn_resconf_t	encodeCtx;
    
	TRACE("ENTER WSAAsyncGetHostByName <%-.100s>\n", name);

	encodeCtx = idnGetContext();

	if (encodeCtx == NULL || name == NULL) {
		ret = _org_WSAAsyncGetHostByName(hWnd, wMsg, name,
						 buf, buflen);
	} else {
		idnHook(hWnd, wMsg, buf, encodeCtx);
		idnConvReq(encodeCtx, name, nbuff, sizeof(nbuff));
		TRACE("Converted Name <%s>\n",
		      dumpName(nbuff, hbuff, sizeof(hbuff)));
		ret = _org_WSAAsyncGetHostByName(hWnd, wMsg, nbuff,
						 buf, buflen);
	}

	TRACE("LEAVE WSAAsyncGetHostByName HANDLE %08x\n", ret);

	return (ret);
}
Exemplo n.º 3
0
void GrGLRenderTarget::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const {
    // Don't log the backing texture's contribution to the memory size. This will be handled by the
    // texture object.

    // Log any renderbuffer's contribution to memory. We only do this if we own the renderbuffer
    // (have a fMSColorRenderbufferID).
    if (fMSColorRenderbufferID) {
        size_t size = this->msaaSamples() * this->totalBytesPerSample();

        // Due to this resource having both a texture and a renderbuffer component, dump as
        // skia/gpu_resources/resource_#/renderbuffer
        SkString dumpName("skia/gpu_resources/resource_");
        dumpName.appendS32(this->getUniqueID());
        dumpName.append("/renderbuffer");

        traceMemoryDump->dumpNumericValue(dumpName.c_str(), "size", "bytes", size);

        if (this->isPurgeable()) {
            traceMemoryDump->dumpNumericValue(dumpName.c_str(), "purgeable_size", "bytes", size);
        }

        SkString renderbuffer_id;
        renderbuffer_id.appendU32(fMSColorRenderbufferID);
        traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_renderbuffer",
                                          renderbuffer_id.c_str());
    }
}
// GrGLTextureRenderTarget must dump both of its superclasses.
void GrGLTextureRenderTarget::dumpMemoryStatistics(
    SkTraceMemoryDump* traceMemoryDump) const {
  GrGLRenderTarget::dumpMemoryStatistics(traceMemoryDump);

  // Also dump the GrGLTexture's memory. Due to this resource having both a
  // texture and a
  // renderbuffer component, dump as skia/gpu_resources/resource_#/texture
  SkString dumpName("skia/gpu_resources/resource_");
  dumpName.appendU32(this->uniqueID().asUInt());
  dumpName.append("/texture");

  // Use the texture's gpuMemorySize, not our own, which includes the
  // renderbuffer as well.
  size_t size = GrGLTexture::gpuMemorySize();

  traceMemoryDump->dumpNumericValue(dumpName.c_str(), "size", "bytes", size);

  if (this->isPurgeable()) {
    traceMemoryDump->dumpNumericValue(dumpName.c_str(), "purgeable_size",
                                      "bytes", size);
  }

  SkString texture_id;
  texture_id.appendU32(this->textureID());
  traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_texture",
                                    texture_id.c_str());
}
Exemplo n.º 5
0
/*
 * hookProc - hookprocedure, used as WH_GETMESSAGE hook
 */
LRESULT CALLBACK
hookProc(int nCode, WPARAM wParam, LPARAM lParam) {
	MSG             *pMsg;
	HOOKPTR         pHook;
	struct  hostent *pHost;
	char            nbuff[256];
	char            hbuff[256];
    
	if (nCode < 0) {
		return (CallNextHookEx(hookHandle, nCode, wParam, lParam));
	} else if (nCode != HC_ACTION) {
		return (0);
	}
	if ((pMsg = (MSG *)lParam) == NULL) {
		return (0);
	}
	if ((pHook = hookListSearch(pMsg->hwnd, pMsg->message)) == NULL) {
		return (0);
	}
    
	/*
	 * Convert the Host Name
	 */
	pHost = (struct hostent *)pHook->pBuf;
	idnPrintf("AsyncComplete Resulting <%s>\n",
		  dumpName(pHost->h_name, hbuff, sizeof(hbuff)));
	if (idnConvRsp(pHook->ctx, pHost->h_name,
		       nbuff, sizeof(nbuff)) == TRUE) {
		idnPrintf("AsyncComplete Converted <%s>\n",
			  dumpName(nbuff, hbuff, sizeof(hbuff)));
		strcpy(pHost->h_name, nbuff);
	}

	/*
	 * Delete target
	 */
	hookListDelete(pHook);

	return (0);
}
Exemplo n.º 6
0
WRAPPER_EXPORT struct hostent FAR * PASCAL FAR
gethostbyaddr(const char FAR * addr, int len, int type) {
	struct hostent FAR *ret;
	char    nbuff[256];
	char    abuff[256];
	char    hbuff[256];
	BOOL    stat;
	idn_resconf_t	encodeCtx;
    
	TRACE("ENTER gethostbyaddr <%s>\n",
	      dumpAddr(addr, len, abuff, sizeof(abuff)));

	encodeCtx = idnGetContext();

	ret = _org_gethostbyaddr(addr, len, type);

	if (ret != NULL && encodeCtx != NULL) {
		TRACE("Resulting Name <%s>\n",
		      dumpName(ret->h_name, hbuff, sizeof(hbuff)));
		stat = idnConvRsp(encodeCtx, ret->h_name,
				  nbuff, sizeof(nbuff));
		if (stat == FALSE) {
			TRACE("Decoding failed - return the name verbatim\n");
		} else {
			TRACE("Converted Back <%s>\n",
			      dumpName(nbuff, hbuff, sizeof(hbuff)));
			strcpy(ret->h_name, nbuff);
		}
	}

	if (ret == NULL) {
		TRACE("LEAVE gethostbyaddr NULL\n") ;
	} else {
		TRACE("LEAVE gethostbyaddr <%s>\n",
		      dumpHost(ret, hbuff, sizeof(hbuff)));
	}    
	return (ret);
}
Exemplo n.º 7
0
void GrGpuResource::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const {
    // Dump resource as "skia/gpu_resources/resource_#".
    SkString dumpName("skia/gpu_resources/resource_");
    dumpName.appendS32(this->getUniqueID());

    traceMemoryDump->dumpNumericValue(dumpName.c_str(), "size", "bytes", this->gpuMemorySize());

    if (this->isPurgeable()) {
        traceMemoryDump->dumpNumericValue(dumpName.c_str(), "purgeable_size", "bytes",
                                          this->gpuMemorySize());
    }

    // Call setMemoryBacking to allow sub-classes with implementation specific backings (such as GL
    // objects) to provide additional information.
    this->setMemoryBacking(traceMemoryDump, dumpName);
}