MCPcopy Create free account
hub / github.com/mhammond/pywin32 / PyWinObject_FromMultipleString

Function PyWinObject_FromMultipleString

win32/src/PyUnicode.cpp:366–390  ·  view source on GitHub ↗

Converts a series of consecutive null terminated strings into a list Note that a read overflow can result if the input is not properly terminated with an extra NULL. Should probably also add a counted version, as win32api uses for REG_MULTI_SZ

Source from the content-addressed store, hash-verified

364// Note that a read overflow can result if the input is not properly terminated with an extra NULL.
365// Should probably also add a counted version, as win32api uses for REG_MULTI_SZ
366PyObject *PyWinObject_FromMultipleString(WCHAR *multistring)
367{
368 PyObject *obelement, *ret=NULL;
369 size_t elementlen;
370 if (multistring==NULL){
371 Py_INCREF(Py_None);
372 return Py_None;
373 }
374 ret=PyList_New(0);
375 if (ret==NULL)
376 return NULL;
377 elementlen=wcslen(multistring);
378 while (elementlen){
379 obelement=PyWinObject_FromWCHAR(multistring, elementlen);
380 if ((obelement==NULL)||(PyList_Append(ret,obelement)==-1)){
381 Py_XDECREF(obelement);
382 Py_DECREF(ret);
383 return NULL;
384 }
385 Py_DECREF(obelement);
386 multistring+=elementlen+1;
387 elementlen=wcslen(multistring);
388 }
389 return ret;
390}
391
392PyObject *PyWinObject_FromMultipleString(char *multistring)
393{

Callers 7

PyGetProfileSectionFunction · 0.85
PyEnumObjectItemsFunction · 0.85
PyEnumObjectsFunction · 0.85
PyExpandCounterPathFunction · 0.85
PyCounterPathCallbackFunction · 0.85
PyBrowseCountersFunction · 0.85
PyEnumPrinterDriversFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected