Network sessions (and assigned drive letters) are processed for each user, and not for each process. Thus, no, you cannot create an SMB session only for your process, unless it works with a special user account. Otherwise, you just need to add the global connection (for example, the CONNECT_TEMPORARY flag, for example), and then remove the connection ( WNetCancelConnection2() ) when you finish using it.
source share