// // Writes the specified GUID structure into the specified memory buffer as 0-terminated string. // ULONG GuidToBuffer( GUID* pGuid, LPTSTR pBuffer, BOOL bQuoted ) { LPTSTR TempStr; if (bQuoted) TempStr = szGuidStrTemp1; else TempStr = szGuidStrTemp2; return(wsprintf(pBuffer, TempStr, htonL(pGuid->Data1), htonS(pGuid->Data2), htonS(pGuid->Data3), htonS(*(USHORT*)&pGuid->Data4[0]), htonL(*(ULONG*)&pGuid->Data4[2]), htonS(*(USHORT*)&pGuid->Data4[6]))); }
int Stream::put( long l) { char pad; NETWORK_TRACE("put long " << l); switch(_code){ case internal: if (put_bytes(&l, sizeof(long)) != sizeof(long)) return FALSE; break; case external: if ((sizeof(int) == sizeof(long)) || (sizeof(long) > INT_SIZE)) { return put((int)l); } else { if (!hton_is_noop()) { // need to convert to network order l = htonL(l); } if (sizeof(long) < INT_SIZE) { pad = (l >= 0) ? 0 : 0xff; // sign extend value for (int s=0; s < INT_SIZE-(int)sizeof(long); s++) { if (put_bytes(&pad, 1) != 1) return FALSE; } } if (put_bytes(&l, sizeof(long)) != sizeof(long)) return FALSE; } break; case ascii: return FALSE; } return TRUE; }