MCPcopy Create free account
hub / github.com/NullArray/WinKernel-Resources / FormatToStream

Function FormatToStream

Drivers/Driver-SRC/setup/devcon/devcon.cpp:24–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22};
23
24void FormatToStream(_In_ FILE * stream, _In_ DWORD fmt,...)
25/*++
26
27Routine Description:
28
29 Format text to stream using a particular msg-id fmt
30 Used for displaying localizable messages
31
32Arguments:
33
34 stream - file stream to output to, stdout or stderr
35 fmt - message id
36 ... - parameters %1...
37
38Return Value:
39
40 none
41
42--*/
43{
44 va_list arglist;
45 LPTSTR locbuffer = NULL;
46 DWORD count;
47
48 va_start(arglist, fmt);
49 count = FormatMessage(FORMAT_MESSAGE_FROM_HMODULE|FORMAT_MESSAGE_ALLOCATE_BUFFER,
50 NULL,
51 fmt,
52 0, // LANGID
53 (LPTSTR) &locbuffer,
54 0, // minimum size of buffer
55 &arglist);
56
57 if(locbuffer) {
58 if(count) {
59 // strip any trailing "\r\n"s and replace by a single "\n"
60 LPTSTR p, q;
61 for(p = q = locbuffer; *p != TEXT('\0'); p++) {
62 if(p != q) {
63 *q = *p;
64 }
65 if(*p != TEXT('\r')) {
66 q++;
67 }
68 }
69 *q = TEXT('\0');
70
71 //
72 // now write to apropriate stream
73 //
74 _fputts(locbuffer,stream);
75 }
76 LocalFree(locbuffer);
77 }
78}
79
80void Padding(_In_ int pad)
81/*++

Callers 15

UsageFunction · 0.85
CommandUsageFunction · 0.85
FailureFunction · 0.85
DumpDeviceDescrFunction · 0.85
DumpDeviceClassFunction · 0.85
DumpDeviceStatusFunction · 0.85
DumpDeviceResourcesFunction · 0.85
DumpDeviceDriverFilesFunction · 0.85
DumpDeviceHwIdsFunction · 0.85
DumpDeviceDriverNodesFunction · 0.85
DumpDeviceStackFunction · 0.85
DumpDriverPackageDataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected