MCPcopy Create free account
hub / github.com/Rat431/ColdAPI_Steam / CFileWriteStreamWriteChunk

Function CFileWriteStreamWriteChunk

src/ColdAPI_Steam/ColdManager.cpp:499–537  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

497 return GlobalStream;
498 }
499 int32_t CFileWriteStreamWriteChunk(uint64_t hStream, const void* pvData, int32_t cubData)
500 {
501 if (!Steam_Config::RemoteStorage)
502 return 1;
503 if (!hStream)
504 return 2;
505 if (!pvData)
506 return 2;
507 if (!cubData)
508 return 2;
509 if (cubData > (100 * 1024 * 1024))
510 return 2;
511
512 auto StreamRequested = Streams.find(hStream);
513 if (StreamRequested == Streams.end()) {
514 return 2;
515 }
516
517 // Write our data
518 if (StreamRequested->second.Buffer == nullptr) {
519 StreamRequested->second.Buffer = (char*)VirtualAlloc(nullptr, cubData, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
520 if (!StreamRequested->second.Buffer) {
521 return 2;
522 }
523 StreamRequested->second.lastbuffersize = cubData;
524 }
525 else {
526 if (cubData > StreamRequested->second.lastbuffersize) {
527 VirtualFree(StreamRequested->second.Buffer, NULL, MEM_RELEASE);
528 StreamRequested->second.Buffer = (char*)VirtualAlloc(nullptr, cubData, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
529 if (!StreamRequested->second.Buffer) {
530 return 2;
531 }
532 StreamRequested->second.lastbuffersize = cubData;
533 }
534 }
535 std::memcpy(StreamRequested->second.Buffer, pvData, cubData);
536 return 1;
537 }
538 int32_t CFileWriteStreamClose(uint64_t hStream)
539 {
540 if (!Steam_Config::RemoteStorage)

Callers 3

Calls

no outgoing calls

Tested by 3