Use the new Unicode API

 * Replace PyUnicode_FromUnicode(NULL, 0) by PyUnicode_New(0, 0)
 * Replce PyUnicode_FromUnicode(str, len) by PyUnicode_FromWideChar(str, len)
 * Replace Py_UNICODE by wchar_t
 * posix_putenv() uses PyUnicode_FromFormat() to create the string, instead
   of PyUnicode_FromUnicode() + _snwprintf()
diff --git a/PC/_msi.c b/PC/_msi.c
index 6fb9c42..0b5b94e 100644
--- a/PC/_msi.c
+++ b/PC/_msi.c
@@ -18,7 +18,7 @@
 uuidcreate(PyObject* obj, PyObject*args)
 {
     UUID result;
-    unsigned short *cresult;
+    wchar_t *cresult;
     PyObject *oresult;
 
     /* May return ok, local only, and no address.
@@ -35,7 +35,7 @@
         return NULL;
     }
 
-    oresult = PyUnicode_FromUnicode(cresult, wcslen(cresult));
+    oresult = PyUnicode_FromWideChar(cresult, wcslen(cresult));
     RpcStringFreeW(&cresult);
     return oresult;
 
@@ -379,7 +379,7 @@
     }
     if (status != ERROR_SUCCESS)
         return msierror((int) status);
-    string = PyUnicode_FromUnicode(res, size);
+    string = PyUnicode_FromWideChar(res, size);
     if (buf != res)
         free(res);
     return string;
@@ -401,7 +401,7 @@
 {
     int status;
     int field;
-    Py_UNICODE *data;
+    wchar_t *data;
 
     if (!PyArg_ParseTuple(args, "iu:SetString", &field, &data))
         return NULL;
@@ -418,7 +418,7 @@
 {
     int status;
     int field;
-    Py_UNICODE *data;
+    wchar_t *data;
 
     if (!PyArg_ParseTuple(args, "iu:SetStream", &field, &data))
         return NULL;
diff --git a/PC/_subprocess.c b/PC/_subprocess.c
index fdcc55b..93e51d3 100644
--- a/PC/_subprocess.c
+++ b/PC/_subprocess.c
@@ -419,14 +419,14 @@
     PyObject* environment;
     wchar_t *wenvironment;
 
-    Py_UNICODE* application_name;
-    Py_UNICODE* command_line;
+    wchar_t* application_name;
+    wchar_t* command_line;
     PyObject* process_attributes; /* ignored */
     PyObject* thread_attributes; /* ignored */
     int inherit_handles;
     int creation_flags;
     PyObject* env_mapping;
-    Py_UNICODE* current_directory;
+    wchar_t* current_directory;
     PyObject* startup_info;
 
     if (! PyArg_ParseTuple(args, "ZZOOiiOZO:CreateProcess",
@@ -454,15 +454,10 @@
     if (PyErr_Occurred())
         return NULL;
 
-    if (env_mapping == Py_None)
-        environment = NULL;
-    else {
+    if (env_mapping != Py_None) {
         environment = getenvironment(env_mapping);
         if (! environment)
             return NULL;
-    }
-
-    if (environment) {
         wenvironment = PyUnicode_AsUnicode(environment);
         if (wenvironment == NULL)
         {
@@ -470,8 +465,10 @@
             return NULL;
         }
     }
-    else
+    else {
+        environment = NULL;
         wenvironment = NULL;
+    }
 
     Py_BEGIN_ALLOW_THREADS
     result = CreateProcessW(application_name,
diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c
index e5a0a17..f277b0a 100755
--- a/PC/msvcrtmodule.c
+++ b/PC/msvcrtmodule.c
@@ -211,7 +211,7 @@
 static PyObject *
 msvcrt_getwch(PyObject *self, PyObject *args)
 {
-    Py_UNICODE ch;
+    wchar_t ch;
 
     if (!PyArg_ParseTuple(args, ":getwch"))
         return NULL;
@@ -254,7 +254,7 @@
 static PyObject *
 msvcrt_getwche(PyObject *self, PyObject *args)
 {
-    Py_UNICODE ch;
+    wchar_t ch;
 
     if (!PyArg_ParseTuple(args, ":getwche"))
         return NULL;
diff --git a/PC/winreg.c b/PC/winreg.c
index 636d5d1..56bda5c 100644
--- a/PC/winreg.c
+++ b/PC/winreg.c
@@ -1227,8 +1227,8 @@
 static PyObject *
 PyExpandEnvironmentStrings(PyObject *self, PyObject *args)
 {
-    Py_UNICODE *retValue = NULL;
-    Py_UNICODE *src;
+    wchar_t *retValue = NULL;
+    wchar_t *src;
     DWORD retValueSize;
     DWORD rc;
     PyObject *o;
@@ -1241,7 +1241,7 @@
         return PyErr_SetFromWindowsErrWithFunction(retValueSize,
                                         "ExpandEnvironmentStrings");
     }
-    retValue = (Py_UNICODE *)PyMem_Malloc(retValueSize * sizeof(Py_UNICODE));
+    retValue = (wchar_t *)PyMem_Malloc(retValueSize * sizeof(wchar_t));
     if (retValue == NULL) {
         return PyErr_NoMemory();
     }
@@ -1252,7 +1252,7 @@
         return PyErr_SetFromWindowsErrWithFunction(retValueSize,
                                         "ExpandEnvironmentStrings");
     }
-    o = PyUnicode_FromUnicode(retValue, wcslen(retValue));
+    o = PyUnicode_FromWideChar(retValue, wcslen(retValue));
     PyMem_Free(retValue);
     return o;
 }
@@ -1537,7 +1537,7 @@
 {
     HKEY hKey;
     PyObject *obKey;
-    Py_UNICODE *valueName;
+    wchar_t *valueName;
     PyObject *obRes;
     PyObject *value;
     BYTE *data;
diff --git a/PC/winsound.c b/PC/winsound.c
index 1ed95ba..b564eab 100644
--- a/PC/winsound.c
+++ b/PC/winsound.c
@@ -72,7 +72,7 @@
 static PyObject *
 sound_playsound(PyObject *s, PyObject *args)
 {
-    Py_UNICODE *wsound;
+    wchar_t *wsound;
     int flags;
     int ok;