forked from External/grumble
go fmt
This commit is contained in:
parent
083163daf9
commit
20eba760e5
15 changed files with 163 additions and 163 deletions
|
|
@ -330,7 +330,7 @@ func (client *Client) udpRecvLoop() {
|
||||||
case mumbleproto.UDPMessageVoiceCELTAlpha:
|
case mumbleproto.UDPMessageVoiceCELTAlpha:
|
||||||
fallthrough
|
fallthrough
|
||||||
case mumbleproto.UDPMessageVoiceCELTBeta:
|
case mumbleproto.UDPMessageVoiceCELTBeta:
|
||||||
if (client.server.Opus) {
|
if client.server.Opus {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
fallthrough
|
fallthrough
|
||||||
|
|
|
||||||
|
|
@ -1,59 +1,59 @@
|
||||||
// Copyright (c) 2012 The Grumble Authors
|
// Copyright (c) 2012 The Grumble Authors
|
||||||
// The use of this source code is goverened by a BSD-style
|
// The use of this source code is goverened by a BSD-style
|
||||||
// license that can be found in the LICENSE-file.
|
// license that can be found in the LICENSE-file.
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
"mumble.info/grumble/pkg/replacefile"
|
"io/ioutil"
|
||||||
"io/ioutil"
|
"mumble.info/grumble/pkg/replacefile"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (server *Server) freezeToFile() (err error) {
|
func (server *Server) freezeToFile() (err error) {
|
||||||
// Close the log file, if it's open
|
// Close the log file, if it's open
|
||||||
if server.freezelog != nil {
|
if server.freezelog != nil {
|
||||||
err = server.freezelog.Close()
|
err = server.freezelog.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure the whole server is synced to disk
|
// Make sure the whole server is synced to disk
|
||||||
fs, err := server.Freeze()
|
fs, err := server.Freeze()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
f, err := ioutil.TempFile(filepath.Join(Args.DataDir, "servers", strconv.FormatInt(server.Id, 10)), ".main.fz_")
|
f, err := ioutil.TempFile(filepath.Join(Args.DataDir, "servers", strconv.FormatInt(server.Id, 10)), ".main.fz_")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
buf, err := proto.Marshal(fs)
|
buf, err := proto.Marshal(fs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
_, err = f.Write(buf)
|
_, err = f.Write(buf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = f.Sync()
|
err = f.Sync()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = f.Close()
|
err = f.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
src := f.Name()
|
src := f.Name()
|
||||||
dst := filepath.Join(Args.DataDir, "servers", strconv.FormatInt(server.Id, 10), "main.fz")
|
dst := filepath.Join(Args.DataDir, "servers", strconv.FormatInt(server.Id, 10), "main.fz")
|
||||||
backup := filepath.Join(Args.DataDir, "servers", strconv.FormatInt(server.Id, 10), "backup.fz")
|
backup := filepath.Join(Args.DataDir, "servers", strconv.FormatInt(server.Id, 10), "backup.fz")
|
||||||
err = replacefile.ReplaceFile(dst, src, backup, replacefile.Flag(0))
|
err = replacefile.ReplaceFile(dst, src, backup, replacefile.Flag(0))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -676,12 +676,12 @@ func (server *Server) finishAuthenticate(client *Client) {
|
||||||
func (server *Server) updateCodecVersions(connecting *Client) {
|
func (server *Server) updateCodecVersions(connecting *Client) {
|
||||||
codecusers := map[int32]int{}
|
codecusers := map[int32]int{}
|
||||||
var (
|
var (
|
||||||
winner int32
|
winner int32
|
||||||
count int
|
count int
|
||||||
users int
|
users int
|
||||||
opus int
|
opus int
|
||||||
enableOpus bool
|
enableOpus bool
|
||||||
txtMsg *mumbleproto.TextMessage = &mumbleproto.TextMessage{
|
txtMsg *mumbleproto.TextMessage = &mumbleproto.TextMessage{
|
||||||
Message: proto.String("<strong>WARNING:</strong> Your client doesn't support the Opus codec the server is switching to, you won't be able to talk or hear anyone. Please upgrade to a client with Opus support."),
|
Message: proto.String("<strong>WARNING:</strong> Your client doesn't support the Opus codec the server is switching to, you won't be able to talk or hear anyone. Please upgrade to a client with Opus support."),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
@ -1357,7 +1357,7 @@ func (server *Server) CurrentPort() int {
|
||||||
|
|
||||||
// Returns the host address the server will listen on when
|
// Returns the host address the server will listen on when
|
||||||
// it is started. This must be an IP address, either IPv4
|
// it is started. This must be an IP address, either IPv4
|
||||||
// or IPv6.
|
// or IPv6.
|
||||||
func (server *Server) HostAddress() string {
|
func (server *Server) HostAddress() string {
|
||||||
host := server.cfg.StringValue("Address")
|
host := server.cfg.StringValue("Address")
|
||||||
if host == "" {
|
if host == "" {
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ func (perm Permission) IsCached() bool {
|
||||||
|
|
||||||
// Clean returns a Permission that has its cache bit cleared.
|
// Clean returns a Permission that has its cache bit cleared.
|
||||||
func (perm Permission) Clean() Permission {
|
func (perm Permission) Clean() Permission {
|
||||||
return perm ^Permission(CachedPermission)
|
return perm ^ Permission(CachedPermission)
|
||||||
}
|
}
|
||||||
|
|
||||||
// An ACL as defined in an ACL context.
|
// An ACL as defined in an ACL context.
|
||||||
|
|
@ -88,11 +88,11 @@ func (acl *ACL) IsChannelACL() bool {
|
||||||
// The permission perm must be a single permission and not a combination of permissions.
|
// The permission perm must be a single permission and not a combination of permissions.
|
||||||
func HasPermission(ctx *Context, user User, perm Permission) bool {
|
func HasPermission(ctx *Context, user User, perm Permission) bool {
|
||||||
// We can't check permissions on a nil ctx.
|
// We can't check permissions on a nil ctx.
|
||||||
if (ctx == nil) {
|
if ctx == nil {
|
||||||
panic("acl: HasPermission got nil context")
|
panic("acl: HasPermission got nil context")
|
||||||
}
|
}
|
||||||
|
|
||||||
// SuperUser can't speak or whisper, but everything else is OK
|
// SuperUser can't speak or whisper, but everything else is OK
|
||||||
if user.UserId() == 0 {
|
if user.UserId() == 0 {
|
||||||
if perm == SpeakPermission || perm == WhisperPermission {
|
if perm == SpeakPermission || perm == WhisperPermission {
|
||||||
return false
|
return false
|
||||||
|
|
|
||||||
|
|
@ -10,18 +10,18 @@ package acl
|
||||||
type Context struct {
|
type Context struct {
|
||||||
// Parent points to the context's parent.
|
// Parent points to the context's parent.
|
||||||
// May be nil if the Context does not have a parent.
|
// May be nil if the Context does not have a parent.
|
||||||
Parent *Context
|
Parent *Context
|
||||||
|
|
||||||
// ACLs is the Context's list of ACL entries.
|
// ACLs is the Context's list of ACL entries.
|
||||||
ACLs []ACL
|
ACLs []ACL
|
||||||
|
|
||||||
// Groups is the Context's representation of groups.
|
// Groups is the Context's representation of groups.
|
||||||
// It is indexed by the Group's name.
|
// It is indexed by the Group's name.
|
||||||
Groups map[string]Group
|
Groups map[string]Group
|
||||||
|
|
||||||
// InheritACL determines whether this context should
|
// InheritACL determines whether this context should
|
||||||
// inherit ACLs from its parent.
|
// inherit ACLs from its parent.
|
||||||
InheritACL bool
|
InheritACL bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// indexOf finds the index of the context ctx in the context chain contexts.
|
// indexOf finds the index of the context ctx in the context chain contexts.
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ func (group *Group) MembersInContext(ctx *Context) map[int]bool {
|
||||||
//
|
//
|
||||||
// The 'current' context is the context that group
|
// The 'current' context is the context that group
|
||||||
// membership is currently being evaluated for.
|
// membership is currently being evaluated for.
|
||||||
//
|
//
|
||||||
// The 'acl' context is the context of the ACL that
|
// The 'acl' context is the context of the ACL that
|
||||||
// that group membership is being evaluated for.
|
// that group membership is being evaluated for.
|
||||||
//
|
//
|
||||||
|
|
@ -337,7 +337,7 @@ func GroupMemberCheck(current *Context, acl *Context, name string, user User) (o
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the list of group names for the given ACL context.
|
// Get the list of group names for the given ACL context.
|
||||||
//
|
//
|
||||||
// This function walks the through the context chain to figure
|
// This function walks the through the context chain to figure
|
||||||
// out all groups that affect the given context whilst considering
|
// out all groups that affect the given context whilst considering
|
||||||
// group inheritance.
|
// group inheritance.
|
||||||
|
|
|
||||||
|
|
@ -20,4 +20,4 @@ type User interface {
|
||||||
// Channel represents a Channel on a Mumble server.
|
// Channel represents a Channel on a Mumble server.
|
||||||
type Channel interface {
|
type Channel interface {
|
||||||
ChannelId() int
|
ChannelId() int
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,10 +61,10 @@ func newBlobReader(rc io.ReadCloser, key string) (*blobReader, error) {
|
||||||
// mismatch.
|
// mismatch.
|
||||||
func (r *blobReader) Read(b []byte) (int, error) {
|
func (r *blobReader) Read(b []byte) (int, error) {
|
||||||
n, err := r.rc.Read(b)
|
n, err := r.rc.Read(b)
|
||||||
_, werr := r.hash.Write(b[:n])
|
_, werr := r.hash.Write(b[:n])
|
||||||
if werr != nil {
|
if werr != nil {
|
||||||
return 0, werr
|
return 0, werr
|
||||||
}
|
}
|
||||||
if err != io.EOF {
|
if err != io.EOF {
|
||||||
return n, err
|
return n, err
|
||||||
}
|
}
|
||||||
|
|
@ -81,4 +81,4 @@ func (r *blobReader) Read(b []byte) (int, error) {
|
||||||
// This Close method simply closes the wrapped io.ReadCloser.
|
// This Close method simply closes the wrapped io.ReadCloser.
|
||||||
func (r *blobReader) Close() error {
|
func (r *blobReader) Close() error {
|
||||||
return r.rc.Close()
|
return r.rc.Close()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,16 +12,16 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type blobReaderTest struct {
|
type blobReaderTest struct {
|
||||||
Key string
|
Key string
|
||||||
ExpectedSum string
|
ExpectedSum string
|
||||||
Data string
|
Data string
|
||||||
}
|
}
|
||||||
|
|
||||||
var blobReaderTests = []blobReaderTest{
|
var blobReaderTests = []blobReaderTest{
|
||||||
{
|
{
|
||||||
Key: "a3da7877f94ad4cf58636a395fff77537cb8b919",
|
Key: "a3da7877f94ad4cf58636a395fff77537cb8b919",
|
||||||
ExpectedSum: "a3da7877f94ad4cf58636a395fff77537cb8b919",
|
ExpectedSum: "a3da7877f94ad4cf58636a395fff77537cb8b919",
|
||||||
Data: "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
Data: "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -38,4 +38,4 @@ func TestBlobReader(t *testing.T) {
|
||||||
t.Errorf("got error: %v", err)
|
t.Errorf("got error: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ var (
|
||||||
ErrNoSuchKey = errors.New("blobstore: no such key")
|
ErrNoSuchKey = errors.New("blobstore: no such key")
|
||||||
|
|
||||||
// ErrBadKey signals that the given key is not well formed.
|
// ErrBadKey signals that the given key is not well formed.
|
||||||
ErrBadKey = errors.New("blobstore: bad key")
|
ErrBadKey = errors.New("blobstore: bad key")
|
||||||
)
|
)
|
||||||
|
|
||||||
// BlobStore represents a simple disk-persisted content addressible
|
// BlobStore represents a simple disk-persisted content addressible
|
||||||
|
|
@ -161,7 +161,7 @@ func (bs BlobStore) Put(buf []byte) (key string, err error) {
|
||||||
//
|
//
|
||||||
// Once we're done, we can atomically rename the file
|
// Once we're done, we can atomically rename the file
|
||||||
// to the correct key.
|
// to the correct key.
|
||||||
//
|
//
|
||||||
// This method is racy: two callers can attempt to write
|
// This method is racy: two callers can attempt to write
|
||||||
// the same blob at the same time. This shouldn't affect
|
// the same blob at the same time. This shouldn't affect
|
||||||
// the consistency of the final blob, but worst case, we've
|
// the consistency of the final blob, but worst case, we've
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@ package cryptstate
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"crypto/aes"
|
"crypto/aes"
|
||||||
"testing"
|
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestOCB2AES128Encrypt(t *testing.T) {
|
func TestOCB2AES128Encrypt(t *testing.T) {
|
||||||
|
|
@ -88,9 +88,9 @@ func TestOCB2AES128Decrypt(t *testing.T) {
|
||||||
func TestXSalsa20Poly1305Encrypt(t *testing.T) {
|
func TestXSalsa20Poly1305Encrypt(t *testing.T) {
|
||||||
cs := CryptState{}
|
cs := CryptState{}
|
||||||
|
|
||||||
var key[32]byte
|
var key [32]byte
|
||||||
var eiv[24]byte
|
var eiv [24]byte
|
||||||
var div[24]byte
|
var div [24]byte
|
||||||
var message [64]byte
|
var message [64]byte
|
||||||
|
|
||||||
for i := range key[:] {
|
for i := range key[:] {
|
||||||
|
|
@ -125,9 +125,9 @@ func TestXSalsa20Poly1305Encrypt(t *testing.T) {
|
||||||
func TestXSalsa20Poly1305Decrypt(t *testing.T) {
|
func TestXSalsa20Poly1305Decrypt(t *testing.T) {
|
||||||
cs := CryptState{}
|
cs := CryptState{}
|
||||||
|
|
||||||
var key[32]byte
|
var key [32]byte
|
||||||
var eiv[24]byte
|
var eiv [24]byte
|
||||||
var div[24]byte
|
var div [24]byte
|
||||||
var expected [64]byte
|
var expected [64]byte
|
||||||
|
|
||||||
for i := range key[:] {
|
for i := range key[:] {
|
||||||
|
|
@ -185,4 +185,4 @@ func TestNullDecrypt(t *testing.T) {
|
||||||
if !bytes.Equal(dst, msg[1:]) {
|
if !bytes.Equal(dst, msg[1:]) {
|
||||||
t.Fatalf("mismatch! got\n%x\n, expected\n%x", dst, msg)
|
t.Fatalf("mismatch! got\n%x\n, expected\n%x", dst, msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
package cryptstate
|
package cryptstate
|
||||||
|
|
||||||
// nullMode implements the NULL CryptoMode
|
// nullMode implements the NULL CryptoMode
|
||||||
type nullMode struct {}
|
type nullMode struct{}
|
||||||
|
|
||||||
// NonceSize returns the nonce size to be used with NULL.
|
// NonceSize returns the nonce size to be used with NULL.
|
||||||
func (n *nullMode) NonceSize() int {
|
func (n *nullMode) NonceSize() int {
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@
|
||||||
package cryptstate
|
package cryptstate
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"unsafe"
|
|
||||||
"golang.org/x/crypto/nacl/secretbox"
|
"golang.org/x/crypto/nacl/secretbox"
|
||||||
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
// secretBoxMode implements the XSalsa20-Poly1305 CryptoMode
|
// secretBoxMode implements the XSalsa20-Poly1305 CryptoMode
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import (
|
||||||
// LogTarget implements the io.Writer interface, allowing
|
// LogTarget implements the io.Writer interface, allowing
|
||||||
// LogTarget to be registered with the regular Go log package.
|
// LogTarget to be registered with the regular Go log package.
|
||||||
// LogTarget multiplexes its incoming writes to multiple optional
|
// LogTarget multiplexes its incoming writes to multiple optional
|
||||||
// output writers, and one main output writer (the log file).
|
// output writers, and one main output writer (the log file).
|
||||||
type LogTarget struct {
|
type LogTarget struct {
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
logfn string
|
logfn string
|
||||||
|
|
|
||||||
|
|
@ -1,62 +1,62 @@
|
||||||
// Copyright (c) 2012 The Grumble Authors
|
// Copyright (c) 2012 The Grumble Authors
|
||||||
// The use of this source code is goverened by a BSD-style
|
// The use of this source code is goverened by a BSD-style
|
||||||
// license that can be found in the LICENSE-file.
|
// license that can be found in the LICENSE-file.
|
||||||
|
|
||||||
package replacefile
|
package replacefile
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"unsafe"
|
"syscall"
|
||||||
"syscall"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
modkernel32 = syscall.NewLazyDLL("kernel32.dll")
|
modkernel32 = syscall.NewLazyDLL("kernel32.dll")
|
||||||
procReplaceFileW = modkernel32.NewProc("ReplaceFileW")
|
procReplaceFileW = modkernel32.NewProc("ReplaceFileW")
|
||||||
)
|
)
|
||||||
|
|
||||||
// Define the syscall.Errno backed-errors here in order to get a cleaner
|
// Define the syscall.Errno backed-errors here in order to get a cleaner
|
||||||
// godoc output.
|
// godoc output.
|
||||||
var (
|
var (
|
||||||
win32_ERROR_UNABLE_TO_MOVE_REPLACEMENT = syscall.Errno(0x498)
|
win32_ERROR_UNABLE_TO_MOVE_REPLACEMENT = syscall.Errno(0x498)
|
||||||
win32_ERROR_UNABLE_TO_MOVE_REPLACEMENT_2 = syscall.Errno(0x499)
|
win32_ERROR_UNABLE_TO_MOVE_REPLACEMENT_2 = syscall.Errno(0x499)
|
||||||
win32_ERROR_UNABLE_TO_REMOVE_REPLACED = syscall.Errno(0x497)
|
win32_ERROR_UNABLE_TO_REMOVE_REPLACED = syscall.Errno(0x497)
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ErrUnableToMoveReplacement error = win32_ERROR_UNABLE_TO_MOVE_REPLACEMENT
|
ErrUnableToMoveReplacement error = win32_ERROR_UNABLE_TO_MOVE_REPLACEMENT
|
||||||
ErrUnableToMoveReplacement2 error = win32_ERROR_UNABLE_TO_MOVE_REPLACEMENT_2
|
ErrUnableToMoveReplacement2 error = win32_ERROR_UNABLE_TO_MOVE_REPLACEMENT_2
|
||||||
ErrUnableToRemoveReplaced error = win32_ERROR_UNABLE_TO_REMOVE_REPLACED
|
ErrUnableToRemoveReplaced error = win32_ERROR_UNABLE_TO_REMOVE_REPLACED
|
||||||
)
|
)
|
||||||
|
|
||||||
func replaceFileW(replaced *uint16, replacement *uint16, backup *uint16, flags uint32) (err error) {
|
func replaceFileW(replaced *uint16, replacement *uint16, backup *uint16, flags uint32) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall6(procReplaceFileW.Addr(), 6, uintptr(unsafe.Pointer(replaced)), uintptr(unsafe.Pointer(replacement)), uintptr(unsafe.Pointer(backup)), uintptr(flags), 0, 0)
|
r1, _, e1 := syscall.Syscall6(procReplaceFileW.Addr(), 6, uintptr(unsafe.Pointer(replaced)), uintptr(unsafe.Pointer(replacement)), uintptr(unsafe.Pointer(backup)), uintptr(flags), 0, 0)
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
err = error(e1)
|
err = error(e1)
|
||||||
} else {
|
} else {
|
||||||
err = syscall.EINVAL
|
err = syscall.EINVAL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReplaceFile calls through to the Win32 ReplaceFile API, which can be found at the following
|
// ReplaceFile calls through to the Win32 ReplaceFile API, which can be found at the following
|
||||||
// URL: http://msdn.microsoft.com/en-us/library/windows/desktop/aa365512(v=vs.85).aspx
|
// URL: http://msdn.microsoft.com/en-us/library/windows/desktop/aa365512(v=vs.85).aspx
|
||||||
func ReplaceFile(replaced string, replacement string, backup string, flags Flag) error {
|
func ReplaceFile(replaced string, replacement string, backup string, flags Flag) error {
|
||||||
replacedPtr, err := syscall.UTF16PtrFromString(replaced)
|
replacedPtr, err := syscall.UTF16PtrFromString(replaced)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
replacementPtr, err := syscall.UTF16PtrFromString(replacement)
|
replacementPtr, err := syscall.UTF16PtrFromString(replacement)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
backupPtr, err := syscall.UTF16PtrFromString(backup)
|
backupPtr, err := syscall.UTF16PtrFromString(backup)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return replaceFileW(replacedPtr, replacementPtr, backupPtr, uint32(flags))
|
return replaceFileW(replacedPtr, replacementPtr, backupPtr, uint32(flags))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue